// EN: Command for bulk inventory deduction (triggered by kitchen ticket served).
// VI: Command trừ kho hàng loạt (được kích hoạt khi phiếu bếp đã phục vụ).

using MediatR;

namespace InventoryService.API.Application.Commands.DeductInventory;

/// <summary>
/// EN: Command to deduct multiple inventory items in a single operation.
/// VI: Command để trừ nhiều inventory items trong một thao tác.
/// </summary>
public record DeductInventoryCommand(
    Guid ShopId,
    Guid ReferenceId,
    string ReferenceType,
    string Reason,
    List<DeductionItem> Items) : IRequest<DeductInventoryResult>;

/// <summary>
/// EN: Individual item to deduct from inventory.
/// VI: Item riêng lẻ để trừ từ kho.
/// </summary>
public record DeductionItem(
    Guid InventoryItemId,
    int Amount,
    string Unit,
    string IngredientName);

/// <summary>
/// EN: Result of bulk inventory deduction.
/// VI: Kết quả trừ kho hàng loạt.
/// </summary>
public record DeductInventoryResult(
    bool Success,
    int ItemsDeducted,
    int ItemsSkipped,
    List<DeductionResultItem> Items);

/// <summary>
/// EN: Result for each individual deduction item.
/// VI: Kết quả cho mỗi item trừ kho riêng lẻ.
/// </summary>
public record DeductionResultItem(
    Guid InventoryItemId,
    string IngredientName,
    bool Deducted,
    string? Error);
