using FluentValidation;

namespace ColaFlow.Modules.ProjectManagement.Application.Commands.CreateProject;

/// <summary>
/// Validator for CreateProjectCommand
/// </summary>
public sealed class CreateProjectCommandValidator : AbstractValidator<CreateProjectCommand>
{
    public CreateProjectCommandValidator()
    {
        RuleFor(x => x.Name)
            .NotEmpty().WithMessage("Project name is required")
            .MaximumLength(200).WithMessage("Project name cannot exceed 200 characters");

        RuleFor(x => x.Key)
            .NotEmpty().WithMessage("Project key is required")
            .MaximumLength(20).WithMessage("Project key cannot exceed 20 characters")
            .Matches("^[A-Z0-9]+$").WithMessage("Project key must contain only uppercase letters and numbers");

        // TenantId and OwnerId are set by the controller from JWT claims, not from request body
        // So we don't validate them here (they'll be Guid.Empty from request, then overridden)
    }
}
