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

namespace TakeoutSaaS.Application.App.Merchants.Validators;

/// <summary>
/// 商户审核命令验证器。
/// </summary>
public sealed class ReviewMerchantValidator : AbstractValidator<ReviewMerchantCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public ReviewMerchantValidator()
    {
        RuleFor(x => x.MerchantId).GreaterThan(0);
        RuleFor(x => x.Remarks)
            .NotEmpty()
            .When(x => !x.Approve);
        RuleFor(x => x.Remarks)
            .MaximumLength(500)
            .When(x => !string.IsNullOrWhiteSpace(x.Remarks));
    }
}
