using FluentValidation;
using Indotalent.Shared.Consts;

namespace Indotalent.Features.Setting.SystemUser.Cqrs;

public class CreateSystemUserValidator : AbstractValidator<CreateSystemUserRequest>
{
    public CreateSystemUserValidator()
    {
        RuleFor(x => x.Email)
            .NotEmpty().WithMessage("Email is required")
            .EmailAddress().WithMessage("Invalid email format");

        RuleFor(x => x.Password)
            .NotEmpty().WithMessage("Password is required")
            .MinimumLength(4).WithMessage("Password must be at least 4 characters");

        RuleFor(x => x.FullName)
            .NotEmpty().WithMessage("Full Name is required")
            .MaximumLength(GlobalConsts.StringLengthShort);

        RuleFor(x => x.SsoIdFirebase).MaximumLength(GlobalConsts.StringLengthMedium);
        RuleFor(x => x.SsoIdKeycloak).MaximumLength(GlobalConsts.StringLengthMedium);
        RuleFor(x => x.SsoIdAzure).MaximumLength(GlobalConsts.StringLengthMedium);
        RuleFor(x => x.SsoIdAws).MaximumLength(GlobalConsts.StringLengthMedium);
        RuleFor(x => x.SsoIdOther1).MaximumLength(GlobalConsts.StringLengthMedium);
        RuleFor(x => x.SsoIdOther2).MaximumLength(GlobalConsts.StringLengthMedium);
        RuleFor(x => x.SsoIdOther3).MaximumLength(GlobalConsts.StringLengthMedium);
    }
}