// EN: FluentValidation validator for UpdateAppointmentStatusCommand.
// VI: FluentValidation validator cho UpdateAppointmentStatusCommand.

using BookingService.API.Application.Commands;
using FluentValidation;

namespace BookingService.API.Application.Validations;

/// <summary>
/// EN: Validator for UpdateAppointmentStatusCommand.
/// VI: Validator cho UpdateAppointmentStatusCommand.
/// </summary>
public class UpdateAppointmentStatusCommandValidator : AbstractValidator<UpdateAppointmentStatusCommand>
{
    private static readonly string[] ValidActions = ["confirm", "start", "complete", "noshow"];

    public UpdateAppointmentStatusCommandValidator()
    {
        RuleFor(x => x.AppointmentId)
            .NotEmpty()
            .WithMessage("Appointment ID is required / ID cuộc hẹn là bắt buộc");

        RuleFor(x => x.Action)
            .NotEmpty()
            .WithMessage("Action is required / Hành động là bắt buộc")
            .Must(action => ValidActions.Contains(action.ToLowerInvariant()))
            .WithMessage("Action must be one of: confirm, start, complete, noshow / Hành động phải là một trong: confirm, start, complete, noshow");
    }
}
