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

namespace TakeoutSaaS.Application.App.Stores.Validators;

/// <summary>
/// 创建营业时段命令验证器。
/// </summary>
public sealed class CreateStoreBusinessHourCommandValidator : AbstractValidator<CreateStoreBusinessHourCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public CreateStoreBusinessHourCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.StartTime).NotEqual(x => x.EndTime).WithMessage("开始时间不能等于结束时间");
        RuleFor(x => x.CapacityLimit).GreaterThanOrEqualTo(0).When(x => x.CapacityLimit.HasValue);
        RuleFor(x => x.Notes).MaximumLength(256);
    }
}
