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

namespace TakeoutSaaS.Application.App.Stores.Validators;

/// <summary>
/// 更新排班命令验证器。
/// </summary>
public sealed class UpdateStoreEmployeeShiftCommandValidator : AbstractValidator<UpdateStoreEmployeeShiftCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public UpdateStoreEmployeeShiftCommandValidator()
    {
        RuleFor(x => x.ShiftId).GreaterThan(0);
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.StaffId).GreaterThan(0);
        RuleFor(x => x.ShiftDate).NotEmpty();
        RuleFor(x => x.StartTime).LessThan(x => x.EndTime).WithMessage("结束时间必须晚于开始时间");
        RuleFor(x => x.Notes).MaximumLength(256);
    }
}
