using FluentValidation;
using TakeoutSaaS.Application.App.Inventory.Commands;

namespace TakeoutSaaS.Application.App.Inventory.Validators;

/// <summary>
/// 扣减库存命令验证器。
/// </summary>
public sealed class DeductInventoryCommandValidator : AbstractValidator<DeductInventoryCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public DeductInventoryCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.ProductSkuId).GreaterThan(0);
        RuleFor(x => x.Quantity).GreaterThan(0);
        RuleFor(x => x.IdempotencyKey).MaximumLength(128);
    }
}
