"""
Nom du script : auth_context_service.py
Chemin : /gitlab-bridge/app/services/auth_context_service.py
Description : Service de normalisation du contexte d'authentification reçu d'OpenWebUI.
Options éventuelles : Aucune.
Exemples d'utilisation : `AuthContextService().normalize(auth)`.
Prérequis : Python 3.11+.
Auteur : Sylvain SCATTOLINI
Date de création / modification : 2026-03-25
Version : 1.1
"""

from __future__ import annotations

from app.schemas.common import AuthContext


class AuthContextService:
    """Normalise les champs d'identité transmis au bridge."""

    @staticmethod
    def normalize(auth: AuthContext) -> AuthContext:
        auth.username = auth.username.strip().lower()
        auth.email = auth.email.strip().lower()
        return auth
