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

namespace TakeoutSaaS.Application.App.Stores.Validators;

/// <summary>
/// 更新桌码命令验证器。
/// </summary>
public sealed class UpdateStoreTableCommandValidator : AbstractValidator<UpdateStoreTableCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public UpdateStoreTableCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.TableId).GreaterThan(0);
        RuleFor(x => x.TableCode).NotEmpty().MaximumLength(32);
        RuleFor(x => x.Capacity).GreaterThan(0).LessThanOrEqualTo(50);
        RuleFor(x => x.Tags).MaximumLength(128);
    }
}
