using FluentValidation;

namespace ColaFlow.Modules.IssueManagement.Application.Commands.CreateIssue;

public sealed class CreateIssueCommandValidator : AbstractValidator<CreateIssueCommand>
{
    public CreateIssueCommandValidator()
    {
        RuleFor(x => x.ProjectId)
            .NotEmpty().WithMessage("ProjectId is required");

        RuleFor(x => x.TenantId)
            .NotEmpty().WithMessage("TenantId is required");

        RuleFor(x => x.Title)
            .NotEmpty().WithMessage("Title is required")
            .MaximumLength(200).WithMessage("Title cannot exceed 200 characters");

        RuleFor(x => x.Description)
            .MaximumLength(2000).WithMessage("Description cannot exceed 2000 characters");

        RuleFor(x => x.Type)
            .IsInEnum().WithMessage("Invalid IssueType");

        RuleFor(x => x.Priority)
            .IsInEnum().WithMessage("Invalid IssuePriority");

        RuleFor(x => x.ReporterId)
            .NotEmpty().WithMessage("ReporterId is required");
    }
}
