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

namespace TakeoutSaaS.Application.App.Tenants.Validators;

/// <summary>
/// 租户列表查询验证器。
/// </summary>
public sealed class SearchTenantsQueryValidator : AbstractValidator<SearchTenantsQuery>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public SearchTenantsQueryValidator()
    {
        RuleFor(x => x.Page).GreaterThan(0);
        RuleFor(x => x.PageSize).InclusiveBetween(1, 200);
        RuleFor(x => x.Keyword).MaximumLength(128);
        RuleFor(x => x.Name).MaximumLength(128);
        RuleFor(x => x.ContactName).MaximumLength(64);
        RuleFor(x => x.ContactPhone).MaximumLength(32);
    }
}
