using Baya.Domain.Entities.Messaging;
using FluentValidation;

namespace Baya.Application.Features.Messaging.Commands.OpenTicket;

public sealed class OpenTicketCommandValidator : AbstractValidator<OpenTicketCommand>
{
    public OpenTicketCommandValidator()
    {
        RuleFor(x => x.Category)
            .NotEmpty()
            .Must(TicketCategory.IsValid)
            .WithMessage($"Category must be one of: {string.Join(", ", TicketCategory.All)}.");

        RuleFor(x => x.Subject).MaximumLength(300);
        RuleFor(x => x.Body).MaximumLength(4000);
    }
}
