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

namespace TakeoutSaaS.Application.App.Inventory.Validators;

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