using CartWise.Application.Results;
using CartWise.Domain.Entities;

namespace CartWise.Application.Interfaces;

public interface IPurchaseService
{
    Task<Result<Purchase>> StartPurchaseAsync(
        Guid householdId,
        string purchasedByUserId,
        DateTime purchasedUtc,
        Guid? storeLocationId = null,
        CancellationToken cancellationToken = default);

    Task<Result<PurchaseItem>> AddPurchaseItemAsync(
        Guid householdId,
        Guid purchaseId,
        string description,
        decimal linePrice,
        decimal quantity = 1m,
        string? unit = null,
        Guid? productId = null,
        Guid? shoppingListItemId = null,
        CancellationToken cancellationToken = default);

    Task<Result<Purchase>> CompletePurchaseAsync(
        Guid householdId,
        Guid purchaseId,
        decimal? tax = null,
        CancellationToken cancellationToken = default);

    Task<Purchase?> GetPurchaseAsync(Guid householdId, Guid purchaseId, CancellationToken cancellationToken = default);

    Task<IReadOnlyList<Purchase>> GetHouseholdPurchasesAsync(Guid householdId, CancellationToken cancellationToken = default);
}
