using Hcs.Broker;
using Hcs.Service.Async.NsiCommon;
using Hcs.WebApp.Data.Hcs;
using Hcs.WebApp.Services;

namespace Hcs.WebApp.BackgroundServices.OperationExecutors.NsiCommon
{
    public class ExportNsiItemExecutor_15_7_0_1(IClient client, IServiceScope scope, Operation operation) : ExecutorBase(client, scope, operation)
    {
        public override async Task<string> ExecuteAsync(CancellationToken cancellationToken)
        {
            var registryService = scope.ServiceProvider.GetRequiredService<RegistryService>();
            var registry = await registryService.GetRegistryByOperationIdAsync(operation.Id);
            return await client.NsiCommon.RequestExportNsiItemAsync(registry.Number, ListGroup.NSI, cancellationToken);
        }
    }
}
