using ERPCore.Domain.Enums;
using ERPCore.Dtos.Common;
using ERPCore.Dtos.Grn;

namespace ERPCore.Services.Interfaces;

/// <summary>Goods-receipt business logic (docs/11 §4; FR-GRN-01..08).</summary>
public interface IGrnService
{
    Task<PagedResponse<GrnSummaryDto>> ListAsync(
        PageQuery query, GrnStatus? status, int? poId, int? vendorId, int? warehouseId, CancellationToken ct = default);

    Task<GrnDto?> GetAsync(int grnId, CancellationToken ct = default);
    Task<GrnDto> CreateAsync(CreateGrnRequest request, CancellationToken ct = default);

    /// <summary>Confirm: create FIFO layers + inbound ledger + update PO receipts, atomically.</summary>
    Task<GrnConfirmResultDto> ConfirmAsync(int grnId, string? idempotencyKey, CancellationToken ct = default);

    Task<ReleaseLineResultDto> ReleaseLineAsync(int grnId, int grnLineId, string action, CancellationToken ct = default);
}
