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

namespace TakeoutSaaS.Application.App.Products.Validators;

/// <summary>
/// 商品列表查询验证器。
/// </summary>
public sealed class SearchProductsQueryValidator : AbstractValidator<SearchProductsQuery>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public SearchProductsQueryValidator()
    {
        RuleFor(x => x.Page).GreaterThan(0);
        RuleFor(x => x.PageSize).InclusiveBetween(1, 200);
        RuleFor(x => x.SortBy).MaximumLength(64);
    }
}
