namespace CashLineERP.Application.Sales;

public interface IDispatchOrderRepository
{
    IReadOnlyCollection<DispatchOrderDetailView> GetDispatchOrders();

    DispatchOrderDetailView? GetDispatchOrder(long dispatchOrderId);

    DispatchOrderDetailView Create(CreateDispatchOrderCommand command);

    DispatchOrderDetailView Post(long dispatchOrderId, long actorUserId, DateTime shippedAtUtc, DateTime? deliveredAtUtc, string? proofOfDeliveryReceiver);

    DispatchOrderDetailView RecordProofOfDelivery(
        long dispatchOrderId,
        long actorUserId,
        DateTime deliveredAtUtc,
        string proofOfDeliveryReceiver,
        string deliveryConditionCode,
        string? proofOfDeliveryReference,
        string? notes);

    DispatchOrderDetailView RecordDeliveryException(
        long dispatchOrderId,
        long actorUserId,
        DateTime deliveredAtUtc,
        string deliveryConditionCode,
        string deliveryExceptionCode,
        string? proofOfDeliveryReceiver,
        string? proofOfDeliveryReference,
        string? notes,
        IReadOnlyCollection<(long DispatchOrderLineId, decimal QuantityFailed)> failedLines);

    DispatchOrderDetailView RecoverFailedDelivery(
        long dispatchOrderId,
        long actorUserId,
        DateTime recoveredAtUtc,
        string? notes,
        IReadOnlyCollection<(long DispatchOrderLineId, decimal QuantityRecovered, long? WarehouseLocationId, string RecoveredStockStatusCode)> recoveredLines);
}
