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

namespace TakeoutSaaS.Application.App.Products.Validators;

/// <summary>
/// 分类状态变更命令验证器。
/// </summary>
public sealed class ChangeProductCategoryStatusCommandValidator : AbstractValidator<ChangeProductCategoryStatusCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public ChangeProductCategoryStatusCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.CategoryId).GreaterThan(0);
        RuleFor(x => x.Status)
            .Must(ProductCategoryManageMapping.IsValidStatus)
            .WithMessage("status 必须为 enabled 或 disabled");
    }
}
