// EN: Interface for inventory service HTTP client.
// VI: Interface cho HTTP client cua inventory service.

namespace FnbEngine.Infrastructure.ExternalServices;

/// <summary>
/// EN: Client interface for calling inventory-service API.
/// VI: Interface client de goi API cua inventory-service.
/// </summary>
public interface IInventoryServiceClient
{
    /// <summary>
    /// EN: Deduct inventory items (bulk deduction via inventory-service API).
    /// VI: Tru kho (tru hang loat qua API inventory-service).
    /// </summary>
    Task<bool> DeductInventoryAsync(DeductInventoryRequest request, CancellationToken cancellationToken = default);
}

/// <summary>
/// EN: Request DTO for bulk inventory deduction.
/// VI: DTO request cho tru kho hang loat.
/// </summary>
public record DeductInventoryRequest(
    Guid ShopId,
    Guid ReferenceId,
    string ReferenceType,
    string Reason,
    List<DeductionItemDto> Items);

/// <summary>
/// EN: Individual item to deduct from inventory.
/// VI: Item rieng le de tru tu kho.
/// </summary>
public record DeductionItemDto(
    Guid InventoryItemId,
    int Amount,
    string Unit,
    string IngredientName);
