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

namespace TakeoutSaaS.Application.App.Orders.Validators;

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