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

namespace TakeoutSaaS.Application.App.SystemParameters.Validators;

/// <summary>
/// 系统参数列表查询验证器。
/// </summary>
public sealed class SearchSystemParametersQueryValidator : AbstractValidator<SearchSystemParametersQuery>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public SearchSystemParametersQueryValidator()
    {
        RuleFor(x => x.Page).GreaterThan(0);
        RuleFor(x => x.PageSize).InclusiveBetween(1, 200);
        RuleFor(x => x.Keyword).MaximumLength(256);
        RuleFor(x => x.SortBy).MaximumLength(64);
    }
}
