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

namespace TakeoutSaaS.Application.App.Products.Validators;

/// <summary>
/// 分类绑定商品命令验证器。
/// </summary>
public sealed class BindCategoryProductsCommandValidator : AbstractValidator<BindCategoryProductsCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public BindCategoryProductsCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.CategoryId).GreaterThan(0);
        RuleFor(x => x.ProductIds).NotEmpty();
        RuleForEach(x => x.ProductIds).GreaterThan(0);
    }
}
