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

namespace Hcs.Broker.Api
{
    /// <inheritdoc cref="IHouseManagementApi"/>
    public class HouseManagementApi(Client client) : ApiBase(client), IHouseManagementApi
    {
        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<IEnumerable<exportAccountResultType>> ExportAccountAsync(string fiasHouseGuid, CancellationToken token = default)
        {
            var request = new ExportAccountRequest(client);
            return await request.ExecuteAsync(fiasHouseGuid, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<IEnumerable<exportHouseResultType>> ExportHouseAsync(string fiasHouseGuid, CancellationToken token = default)
        {
            var request = new ExportHouseRequest(client);
            return await request.ExecuteAsync(fiasHouseGuid, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<IEnumerable<exportSupplyResourceContractResultType>> ExportSupplyResourceContractDataAsync(CancellationToken token = default)
        {
            var request = new ExportSupplyResourceContractDataRequest(client);
            return await request.ExecuteAsync(token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<exportSupplyResourceContractResultType> ExportSupplyResourceContractDataAsync(Guid contractRootGuid, CancellationToken token = default)
        {
            var request = new ExportSupplyResourceContractDataRequest(client);
            return await request.ExecuteAsync(contractRootGuid, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<exportSupplyResourceContractResultType> ExportSupplyResourceContractDataAsync(string contractNumber, CancellationToken token = default)
        {
            var request = new ExportSupplyResourceContractDataRequest(client);
            return await request.ExecuteAsync(contractNumber, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<IEnumerable<exportSupplyResourceContractObjectAddressResultType>> ExportSupplyResourceContractObjectAddressDataAsync(Guid contractRootGuid, CancellationToken token = default)
        {
            var request = new ExportSupplyResourceContractObjectAddressDataRequest(client);
            return await request.ExecuteAsync(contractRootGuid, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<bool> ImportAccountDataAsync(ImportAccountDataPayload payload, CancellationToken token = default)
        {
            var request = new ImportAccountDataRequest(client);
            return await request.ExecuteAsync(payload, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<importContractResultType> ImportContractDataAsync(ImportContractDataPayload payload, CancellationToken token = default)
        {
            var request = new ImportContractDataRequest(client);
            return await request.ExecuteAsync(payload, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<bool> ImportHouseUODataAsync(ImportLivingHouseUODataPayload payload, CancellationToken token = default)
        {
            var request = new ImportHouseUODataRequest(client);
            return await request.ExecuteAsync(payload, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<bool> ImportMeteringDeviceDataAsync(MeteringDeviceFullInformationType meteringDevice, CancellationToken token = default)
        {
            var request = new ImportMeteringDeviceDataRequest(client);
            return await request.ExecuteAsync(meteringDevice, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<bool> ImportNotificationDataAsync(ImportNotificationDataPayload payload, CancellationToken token = default)
        {
            var request = new ImportNotificationDataRequest(client);
            return await request.ExecuteAsync(payload, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<getStateResultImportResultCommonResultImportSupplyResourceContract> ImportSupplyResourceContractDataAsync(ImportSupplyResourceContractDataPayload payload, CancellationToken token = default)
        {
            var request = new ImportSupplyResourceContractDataRequest(client);
            return await request.ExecuteAsync(payload, token);
        }

        /// <inheritdoc cref="IHouseManagementApi"/>
        public async Task<getStateResultImportResultCommonResultImportSupplyResourceContractProject> ImportSupplyResourceContractProjectAsync(ImportSupplyResourceContractProjectPayload payload, CancellationToken token = default)
        {
            var request = new ImportSupplyResourceContractProjectRequest(client);
            return await request.ExecuteAsync(payload, token);
        }
    }
}
