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

namespace TakeoutSaaS.Application.App.Tenants.Validators;

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

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