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

namespace TakeoutSaaS.Application.App.Tenants.Validators;

/// <summary>
/// 撤销公告命令验证器。
/// </summary>
public sealed class RevokeAnnouncementCommandValidator : AbstractValidator<RevokeAnnouncementCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public RevokeAnnouncementCommandValidator()
    {
        RuleFor(x => x.AnnouncementId)
            .GreaterThan(0);

        RuleFor(x => x.RowVersion)
            .NotNull()
            .Must(rowVersion => rowVersion != null && rowVersion.Length > 0)
            .WithMessage("RowVersion 不能为空");
    }
}
