package dev.lions.user.manager.validation;

/**
 * Constantes de validation pour les DTOs
 * Centralise les règles de validation communes
 */
public final class ValidationConstants {

    private ValidationConstants() {
        // Classe utilitaire, pas d'instanciation
    }

    // Username
    public static final int USERNAME_MIN_LENGTH = 3;
    public static final int USERNAME_MAX_LENGTH = 100;
    public static final String USERNAME_PATTERN = "^[a-zA-Z0-9._-]+$";
    public static final String USERNAME_PATTERN_MESSAGE = "Le nom d'utilisateur ne peut contenir que des lettres, chiffres, points, tirets et underscores";

    // Email
    public static final String EMAIL_PATTERN = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
    public static final String EMAIL_PATTERN_MESSAGE = "Format d'email invalide";

    // Nom et Prénom
    public static final int NAME_MIN_LENGTH = 2;
    public static final int NAME_MAX_LENGTH = 100;
    public static final String NAME_PATTERN = "^[a-zA-ZÀ-ÿ\\s'-]+$";
    public static final String NAME_PATTERN_MESSAGE = "Le nom ne peut contenir que des lettres, espaces, apostrophes et tirets";

    // Téléphone
    public static final String PHONE_PATTERN = "^\\+?[0-9\\s.-]{8,20}$";
    public static final String PHONE_PATTERN_MESSAGE = "Format de téléphone invalide";

    // Mot de passe
    public static final int PASSWORD_MIN_LENGTH = 8;
    public static final int PASSWORD_MAX_LENGTH = 100;
    public static final String PASSWORD_PATTERN = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$";
    public static final String PASSWORD_PATTERN_MESSAGE = "Le mot de passe doit contenir au moins 8 caractères, une majuscule, une minuscule, un chiffre et un caractère spécial";

    // Role
    public static final int ROLE_NAME_MIN_LENGTH = 2;
    public static final int ROLE_NAME_MAX_LENGTH = 100;
    public static final String ROLE_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
    public static final String ROLE_NAME_PATTERN_MESSAGE = "Le nom du rôle ne peut contenir que des lettres, chiffres, underscores et tirets";

    // Realm
    public static final String REALM_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
    public static final String REALM_NAME_PATTERN_MESSAGE = "Le nom du realm ne peut contenir que des lettres, chiffres, underscores et tirets";

    // UUID
    public static final String UUID_PATTERN = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";
    public static final String UUID_PATTERN_MESSAGE = "Format UUID invalide";

    // Messages d'erreur génériques
    public static final String REQUIRED_FIELD = "Ce champ est obligatoire";
    public static final String INVALID_FORMAT = "Format invalide";
    public static final String TOO_SHORT = "Valeur trop courte";
    public static final String TOO_LONG = "Valeur trop longue";

    // Pagination
    public static final int DEFAULT_PAGE_SIZE = 20;
    public static final int MAX_PAGE_SIZE = 100;
    public static final int MIN_PAGE_SIZE = 1;

    // Audit
    public static final int MAX_DESCRIPTION_LENGTH = 500;
    public static final int MAX_COMMENT_LENGTH = 1000;
    public static final int MAX_ERROR_MESSAGE_LENGTH = 2000;

    // IP Address
    public static final String IP_ADDRESS_PATTERN = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
    public static final String IP_ADDRESS_PATTERN_MESSAGE = "Format d'adresse IP invalide";
}
