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

namespace TakeoutSaaS.Application.App.SystemParameters.Validators;

/// <summary>
/// 更新系统参数命令验证器。
/// </summary>
public sealed class UpdateSystemParameterCommandValidator : AbstractValidator<UpdateSystemParameterCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public UpdateSystemParameterCommandValidator()
    {
        RuleFor(x => x.ParameterId).GreaterThan(0);
        RuleFor(x => x.Key).NotEmpty().MaximumLength(128);
        RuleFor(x => x.Value).NotEmpty();
        RuleFor(x => x.Description).MaximumLength(512);
        RuleFor(x => x.SortOrder).GreaterThanOrEqualTo(0);
    }
}
