using SIGCM2.Application.Abstractions.Persistence;

namespace SIGCM2.Application.Products.Pricing;

/// <summary>
/// PRD-003 — Implementación de IProductPricingService.
/// Delega en IProductPriceRepository.GetActiveAsync para el lookup de ventana civil.
/// </summary>
public sealed class ProductPricingService : IProductPricingService
{
    private readonly IProductPriceRepository _repo;

    public ProductPricingService(IProductPriceRepository repo)
    {
        _repo = repo;
    }

    /// <inheritdoc />
    public async Task<decimal?> GetPriceAtAsync(int productId, DateOnly date, CancellationToken ct = default)
    {
        var price = await _repo.GetActiveAsync(productId, date, ct);
        return price?.Price;
    }
}
