using ERPCore.Dtos.Common;
using ERPCore.Dtos.Sales;

namespace ERPCore.Services.Interfaces;

public interface ISalesDayEndService
{
    /// <summary>What closing <paramref name="businessDate"/> for this cashier would include right now
    /// (or the already-closed record's totals, if it's already closed).</summary>
    Task<SalesDayEndPreviewDto> PreviewAsync(int cashierUserId, DateOnly businessDate, CancellationToken ct = default);

    /// <summary>Closes the day: locks every Posted slip for (CashierUserId, BusinessDate) against this
    /// record and posts one consolidated GL journal entry. Idempotent — a second call for an
    /// already-closed date replays the existing record rather than erroring.</summary>
    Task<SalesDayEndDto> CloseAsync(CreateSalesDayEndRequest request, CancellationToken ct = default);

    Task<PagedResponse<SalesDayEndSummaryDto>> ListAsync(PageQuery query, int? cashierUserId, CancellationToken ct = default);

    Task<SalesDayEndDto?> GetAsync(int salesDayEndId, CancellationToken ct = default);
}
