using FluentValidation;

namespace Baya.Application.Features.Verification.Commands.UpsertStepType;

public sealed class AdminUpsertStepTypeCommandValidator : AbstractValidator<AdminUpsertStepTypeCommand>
{
    public AdminUpsertStepTypeCommandValidator()
    {
        RuleFor(x => x.Code)
            .NotEmpty()
            .MaximumLength(50)
            .Matches("^[a-z][a-z0-9_]*$")
            .WithMessage("Code must be a stable snake_case machine key (a–z, 0–9, underscore).");

        RuleFor(x => x.DisplayName).NotEmpty().MaximumLength(150);
        RuleFor(x => x.Description).MaximumLength(500);
        RuleFor(x => x.AutomationProvider).MaximumLength(50);
        RuleFor(x => x.SortOrder).GreaterThanOrEqualTo(0);
    }
}
