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

namespace Hcs.Broker.Api
{
    /// <inheritdoc cref="IDeviceMeteringApi"/>
    public class DeviceMeteringApi(Client client) : ApiBase(client), IDeviceMeteringApi
    {
        /// <inheritdoc cref="IDeviceMeteringApi"/>
        public async Task<IEnumerable<exportMeteringDeviceHistoryResultType>> ExportMeteringDeviceHistoryAsync(ExportMeteringDeviceHistoryPayload payload, CancellationToken token = default)
        {
            var request = new ExportMeteringDeviceHistoryRequest(client);
            return await request.ExecuteAsync(payload, token);
        }

        /// <inheritdoc cref="IDeviceMeteringApi"/>
        public async Task<bool> ImportMeteringDeviceValuesAsync(importMeteringDeviceValuesRequestMeteringDevicesValues values, CancellationToken token = default)
        {
            var request = new ImportMeteringDeviceValuesRequest(client);
            return await request.ExecuteAsync(values, token);
        }
    }
}
