using Baya.Domain.Entities.Holidays;
using FluentValidation;

namespace Baya.Application.Features.Holidays.Commands.UpsertHoliday;

public sealed class UpsertHolidayCommandValidator : AbstractValidator<UpsertHolidayCommand>
{
    public UpsertHolidayCommandValidator()
    {
        RuleFor(x => x.HolidayDate).NotEqual(default(DateOnly));
        RuleFor(x => x.NameFa).NotEmpty().MaximumLength(200);
        RuleFor(x => x.Type)
            .Must(t => t is HolidayType.Official or HolidayType.Religious or HolidayType.National)
            .WithMessage($"Type must be one of: {HolidayType.Official}, {HolidayType.Religious}, {HolidayType.National}.");
    }
}
