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

namespace TakeoutSaaS.Application.App.Inventory.Validators;

/// <summary>
/// 批次维护命令验证器。
/// </summary>
public sealed class UpsertInventoryBatchCommandValidator : AbstractValidator<UpsertInventoryBatchCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public UpsertInventoryBatchCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.ProductSkuId).GreaterThan(0);
        RuleFor(x => x.BatchNumber).NotEmpty().MaximumLength(64);
        RuleFor(x => x.Quantity).GreaterThan(0);
        RuleFor(x => x.RemainingQuantity).GreaterThanOrEqualTo(0);
    }
}
