using FluentValidation;
using Indotalent.Shared.Consts;

namespace Indotalent.Features.Setting.SystemUser.Cqrs;

public class UpdateSystemUserValidator : AbstractValidator<UpdateSystemUserRequest>
{
    public UpdateSystemUserValidator()
    {
        RuleFor(x => x.Id).NotEmpty().WithMessage("User ID is required for update");
        RuleFor(x => x.Email)
            .NotEmpty().WithMessage("Email is required")
            .EmailAddress().WithMessage("Invalid email format");

        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);
    }
}
