public async Task <IActionResult> CalculateNetRevenue
        (
            [FromServices] ILaborTaxesService service,
            [FromBody] CalculateNetRevenueRequest request,
            [FromQuery] DateTime?date,
            CancellationToken cancellationToken = default
        )
        {
            CalculateNetRevenueResult resp = await service.CalculateNetRevenue(request.Type.Value, request.Revenue, request.DependentsNumber, date, cancellationToken);

            if (resp == null)
            {
                return(BadRequest(resp));
            }
            return(Ok(resp));
        }
        ///<inheritdoc/>
        public Task <CalculateBaseResult <CalculateNetRevenueResult> > CalculateNetRevenue(CalculateNetRevenueArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            if (string.IsNullOrWhiteSpace(_url))
            {
                throw new InvalidOperationException($"The service url '{_url} is null or empty!");
            }

            _logger?.LogInformation("Process CalculateIrpf command");

            using GrpcChannel channel = CreateAuthenticatedChannel(_url);
            LaborTaxesClient client = new LaborTaxesClient(channel);

            CalculateBaseResult <CalculateNetRevenueResult> result = new CalculateBaseResult <CalculateNetRevenueResult>();

            try
            {
                CalculateNetRevenueRequest request = new CalculateNetRevenueRequest()
                {
                    InssType         = MapInssType(args.InssType),
                    Revenue          = (double)args.Revenue,
                    DependentsNumber = args.DependentsNumber,
                    ReferenceDate    = args.ReferenceDate?.ToString("yyyy-MM-dd") ?? string.Empty
                };

                CalculateNetRevenueReply reply = client.CalculateNetRevenue(request);
                result.Success = reply.Success;
                if (reply.Success)
                {
                    result.Data = new CalculateNetRevenueResult()
                    {
                        Inss = new CalculateInssResult()
                        {
                            Rate    = (decimal)reply.Data.Inss.Rate,
                            Amount  = (decimal)reply.Data.Inss.Amount,
                            IsLimit = reply.Data.Inss.IsLimit
                        },
                        Irpf = new CalculateIrpfResult()
                        {
                            CalculationBasis = (decimal)reply.Data.Irpf.CalculationBasis,
                            Amount           = (decimal)reply.Data.Irpf.Amount,
                            Rate             = (decimal)reply.Data.Irpf.Rate
                        }
                    };
                    _logger?.LogInformation("CalculateIrpf Success");
                }
                else
                {
                    result.Data   = null;
                    result.Errors = reply.Errors;
                    _logger?.LogInformation("CalculateIrpf FAIL, {Errors}", result.Errors);
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Errors  = ex.Message;
                _logger?.LogInformation("CalculateIrpf FAIL, {Message}", ex.Message);
            }

            return(Task.FromResult(result));
        }