using Hcs.Broker.Api.Payload.Bills;
using Hcs.Broker.Api.Request.Bills;
using Hcs.Service.Async.Bills;

namespace Hcs.Broker.Api
{
    /// <inheritdoc cref="IBillsApi"/>
    public class BillsApi(Client client) : ApiBase(client), IBillsApi
    {
        /// <inheritdoc cref="IBillsApi"/>
        public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataByPaymentDocumentIDAsync(string paymentDocumentID, CancellationToken token = default)
        {
            var request = new ExportPaymentDocumentDataRequest(client);
            return await request.ExecuteByPaymentDocumentIDAsync(paymentDocumentID, token);
        }

        /// <inheritdoc cref="IBillsApi"/>
        public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataByAccountNumberAsync(short year, int month, string fiasHouseGuid, string accountNumber, CancellationToken token = default)
        {
            var request = new ExportPaymentDocumentDataRequest(client);
            return await request.ExecuteByAccountNumberAsync(year, month, fiasHouseGuid, accountNumber, token);
        }

        /// <inheritdoc cref="IBillsApi"/>
        public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataByPaymentDocumentNumberAsync(short year, int month, string fiasHouseGuid, string paymentDocumentNumber, CancellationToken token = default)
        {
            var request = new ExportPaymentDocumentDataRequest(client);
            return await request.ExecuteByPaymentDocumentNumberAsync(year, month, fiasHouseGuid, paymentDocumentNumber, token);
        }

        /// <inheritdoc cref="IBillsApi"/>
        public async Task<bool> ImportPaymentDocumentDataAsync(ImportPaymentDocumentDataPayload payload, CancellationToken token = default)
        {
            var request = new ImportPaymentDocumentDataRequest(client);
            return await request.ExecuteAsync(payload, token);
        }
    }
}
