ile "C:\Users\alexa\AppData\Roaming\Python\Python310\site-packages\flask\app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "C:\Users\alexa\Desktop\sae-fest-iuto-back\Code\appli\app.py", line 106, in connecter
    session['user_id'] = user.getIdUser()
AttributeError: 'User' object has no attribute 'getIdUser'@app.route('/connecter', methods=['POST'])
def connecter():
    connexion_bd = ConnexionBD()
    userbd = UserBD(connexion_bd)
    data = request.get_json()
    print(data)
    email = data["email"]
    password = data["password"]
    if userbd.exist_user(email, password):
        user = userbd.get_user_by_email(email)
        session['user_id'] = user.getIdUser()
        return userbd.user_to_json(userbd.get_user_by_email(email))
    else:
        return jsonify({"error": "Utilisateur non trouve"})from flask import session
from BD import User
from ConnexionBD import ConnexionBD
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.sql.expression import text
import json

class UserBD:
    def __init__(self, conx: ConnexionBD):
        self.connexion = conx

    def email_exists(self, email):
        try:
            query = text("SELECT count(*) FROM USER WHERE emailUser = :email")
            result = self.connexion.get_connexion().execute(query, {"email": email})
            return result.fetchone()[0] == 1
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")

    def exist_user(self, email, password):
        try:
            query = text("SELECT count(*) FROM USER WHERE emailUser = :email AND mdpUser = :password")
            result = self.connexion.get_connexion().execute(query, {"email": email, "password": password})
            return result.fetchone()[0] == 1
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")

    def exist_user_with_id(self, idUser, password):
        try:
            query = text("SELECT count(*) FROM USER WHERE idUser = :idUser AND mdpUser = :password")
            result = self.connexion.get_connexion().execute(query, {"idUser": idUser, "password": password})
            return result.fetchone()[0] == 1
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")

    def get_user_by_email(self, email):
        try:
            query = text("SELECT idUser, pseudoUser, mdpUser, emailUser, statutUser FROM USER WHERE emailUser = :email")
            result = self.connexion.get_connexion().execute(query, {"email": email})
            idUser, pseudoUser, mdpUser, emailUser, statutUser = result.fetchone()
            return User(idUser, pseudoUser, mdpUser, emailUser, statutUser)
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")

    def add_user(self, pseudo, email, password):
        try:
            query = text("INSERT INTO USER (pseudoUser, emailUser, mdpUser, statutUser) VALUES (:pseudo, :email, :password, 'user')")
            print("INSERT INTO USER : " + "\n"
                  + "pseudoUser = " + pseudo + "\n"
                  + "emailUser = " + email + "\n"
                  + "mdpUser = " + password + "\n")
            self.connexion.get_connexion().execute(query, {"pseudo": pseudo, "email": email, "password": password})
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            if ("emailUser" in str(e) and "Duplicate entry" in str(e)):
                return "emailErr"
            print(f"La requête a échoué : {e}")
            return False
        
    def update_user(self, idUser, email, pseudo, password):
        try:
            query = text("UPDATE USER SET pseudoUser = :pseudo, emailUser = :email, mdpUser = :password WHERE idUser = :idUser")
            print("UPDATE USER : " + "\n"
                + "idUser = " + str(idUser) + "\n"
                + "pseudoUser = " + pseudo + "\n"
                + "emailUser = " + email + "\n"
                + "mdpUser = " + password + "\n")
            self.connexion.get_connexion().execute(query, {"idUser": idUser, "pseudo": pseudo, "email": email, "password": password})
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            if ("emailUser" in str(e) and "Duplicate entry" in str(e)):
                return "emailErr"
            print(f"La requête a échoué : {e}")
            return False
    
    def ajouterCodeVerification(self, emailUser, code):
        try:
            query = text("UPDATE USER SET codeTempUser = :code WHERE emailUser = :email")
            self.connexion.get_connexion().execute(query, {"code": code, "email": emailUser})
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")
            return False
        
    def tester_code_verification(self, emailUser, code):
        try:
            query = text("SELECT count(*) FROM USER WHERE emailUser = :email AND codeTempUser = :code")
            # si la requete retourne 1 alors le code est bon
            result = self.connexion.get_connexion().execute(query, {"email": emailUser, "code": code})
            return result.fetchone()[0] == 1
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")
            return False
        
    def update_password(self,emailUser, newPassword):
        try:
            query = text("UPDATE USER SET mdpUser= :mdp, codeTempUser = null WHERE emailUser = :email")
            self.connexion.get_connexion().execute(query, {"mdp": newPassword, "email": emailUser})
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")
            return False

    def user_to_json(self, user):
        return json.dumps(user.to_dict(), ensure_ascii=False)
    
    def get_all_users(self):
        try:
            query = text("select idUser, pseudoUser, mdpUser, emailUser, statutUser from USER")
            result = self.connexion.get_connexion().execute(query)
            users = []
            for idUser, pseudoUser, mdpUser, emailUser, statutUser in result:
                users.append(User(idUser, pseudoUser, mdpUser, emailUser, statutUser))
            return users
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")
            return False
        
    def insert_user_admin(self, user):
        try:
            query = text("INSERT INTO USER (pseudoUser, mdpUser, emailUser, statutUser) VALUES (:pseudo, :password, :email, :statut)")
            result = self.connexion.get_connexion().execute(query, {"pseudo": user.get_pseudoUser(), "password": user.get_mdpUser(), "email": user.get_emailUser(), "statut": user.get_statutUser()})
            id_user = result.lastrowid
            print(f"L'utilisateur {id_user} a été ajouté")
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            if ("emailUser" in str(e) and "Duplicate entry" in str(e)):
                return "emailErr"
            print(f"La requête a échoué : {e}")
            return False
        
    def delete_user_by_id(self, idUser):
        try:
            query = text("DELETE FROM USER WHERE idUser = :idUser")
            self.connexion.get_connexion().execute(query, {"idUser": idUser})
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")
            return False
        
    def update_user_admin(self, user):
        try:
            query = text("UPDATE USER SET pseudoUser = :pseudo, mdpUser = :password, emailUser = :email WHERE idUser = :idUser")
            self.connexion.get_connexion().execute(query, {"pseudo": user.get_pseudoUser(), "password": user.get_mdpUser(), "email": user.get_emailUser(), "idUser": user.get_idUser()})
            print(f"L'utilisateur {user.get_idUser()} a été modifié")
            self.connexion.get_connexion().commit()
            return True
        except SQLAlchemyError as e:
            if ("emailUser" in str(e) and "Duplicate entry" in str(e)):
                return "emailErr"
            print(f"La requête a échoué : {e}")
            return False
        
    def get_user_by_id(self, idUser):
        try:
            query = text("SELECT idUser, pseudoUser, mdpUser, emailUser, statutUser FROM USER WHERE idUser = :idUser")
            result = self.connexion.get_connexion().execute(query, {"idUser": idUser})
            idUser, pseudoUser, mdpUser, emailUser, statutUser = result.fetchone()
            return User(idUser, pseudoUser, mdpUser, emailUser, statutUser)
        except SQLAlchemyError as e:
            print(f"La requête a échoué : {e}")
            return False
    
    def get_authenticated_user_id():
        user_id = session.get('user_id')
        if user_id:
            return user_id
        from datetime import datetime, date, time, timedelta

class Faq:
    def __init__(self, idFaq: int, question: str, reponse: str):
        self._idFaq = idFaq
        self._question = question
        self._reponse = reponse
    
    def get_idFaq(self):
        return self._idFaq
    
    def get_question(self):
        return self._question
    
    def get_reponse(self):
        return self._reponse
    
    def to_dict(self):
        return {
            "idFaq": self._idFaq,
            "question": self._question,
            "reponse": self._reponse
        }

class User:         
    def __init__(self, idUser: int, pseudoUser: str, mdpUser: str, emailUser: str, statutUser: str):
        self.__idUser = idUser
        self.__pseudoUser = pseudoUser
        self.__mdpUser = mdpUser
        self.__emailUser = emailUser
        self.__statutUser = statutUser
        
    def get_idUser(self):
        return self.__idUser
    
    def get_pseudoUser(self):
        return self.__pseudoUser
    
    def get_mdpUser(self):
        return self.__mdpUser
    
    def get_emailUser(self):
        return self.__emailUser
    
    def get_statutUser(self):
        return self.__statutUser
    
    def set_pseudoUser(self, pseudoUser):
        self.__pseudoUser = pseudoUser
        
    def set_mdpUser(self, mdpUser):
        self.__mdpUser = mdpUser
        
    def set_emailUser(self, emailUser):
        self.__emailUser = emailUser

    def to_dict(self):
        return {
            "idUser": self.__idUser,
            "pseudoUser": self.__pseudoUser,
            "emailUser": self.__emailUser
        }

class Festival:
    def __init__(self, idF: int, nomF: str, villeF: str, dateDebutF: str, dateFinF: str):
        self.__idF = idF
        self.__nomF = nomF
        self.__villeF = villeF
        self.__dateDebutF = dateDebutF if isinstance(dateDebutF, date) else datetime.strptime(dateDebutF, '%Y-%m-%d').date()
        self.__dateFinF = dateFinF if isinstance(dateFinF, date) else datetime.strptime(dateFinF, '%Y-%m-%d').date()
        
    def get_idF(self):
        return self.__idF

    def get_nomF(self):
        return self.__nomF
    
    def get_villeF(self):
        return self.__villeF
    
    def get_dateDebutF(self):
        return self.__dateDebutF
    
    def get_dateFinF(self):
        return self.__dateFinF
    
    def __repr__(self):
        return f"({self.__idF}, {self.__nomF}, {self.__villeF}, {self.__dateDebutF}, {self.__dateFinF})"
    
    def to_dict(self):
        return {
            "idF": self.__idF,
            "nomF": self.__nomF,
            "villeF": self.__villeF,
            "dateDebutF": self.__dateDebutF.isoformat(),
            "dateFinF": self.__dateFinF.isoformat()
        }

    
class Type_Billet:
    def __init__(self, idType: int, duree: int):
        self.__idType = idType
        self.__duree = duree
    
    def get_idType(self):
        return self.__idType
    
    def get_duree(self):
        return self.__duree
    
    def to_dict(self):
        return {
            "idType": self.__idType,
            "duree": self.__duree
        }
    

class Spectateur:
    def __init__(self, idS: int, nomS: str, prenomS: str, adresseS: str, emailS: str, mdpS: str):
        self.__idS = idS
        self.__nomS = nomS
        self.__prenomS = prenomS
        self.__adresseS = adresseS
        self.__emailS = emailS
        self.__mdpS = mdpS
    
    def get_idS(self):
        return self.__idS
    
    def get_nomS(self):
        return self.__nomS
    
    def get_prenomS(self):
        return self.__prenomS
    
    def get_adresseS(self):
        return self.__adresseS
    
    def get_emailS(self):
        return self.__emailS
    
    def get_mdpS(self):
        return self.__mdpS
    
    def to_dict(self):
        return {
            "idS": self.__idS,
            "nomS": self.__nomS,
            "prenomS": self.__prenomS,
            "adresseS": self.__adresseS,
            "emailS": self.__emailS,
            "mdpS": self.__mdpS
        }

class Billet:
    def __init__(self, idB: int, idF: int, idType: int, idS: int, prix: int, dateAchat: str, dateDebutB: str, dateFinB: str):
        self.__idB = idB
        self.__idF = idF
        self.__idType = idType
        self.__idS = idS
        self.__prix = prix
        self.__dateAchat = dateAchat if isinstance(dateAchat, date) else datetime.strptime(dateAchat, '%Y-%m-%d').date() or datetime.strptime('0000-00-00', '%Y-%m-%d %H:%M:%S').date() 
        if dateDebutB != None and dateFinB != None:
            self.__dateDebutB = dateDebutB if isinstance(dateDebutB, date) else datetime.strptime(dateDebutB, '%Y-%m-%d').date() or datetime.strptime('0000-00-00', '%Y-%m-%d %H:%M:%S').date() 
            self.__dateFinB = dateFinB if isinstance(dateFinB, date) else datetime.strptime(dateFinB, '%Y-%m-%d').date() or datetime.strptime('0000-00-00', '%Y-%m-%d %H:%M:%S').date() 
        else:
            self.__dateDebutB = None
            self.__dateFinB = None
            
    def get_idB(self):
        return self.__idB
    
    def get_idFestival(self):
        return self.__idF
    
    def get_idType(self):
        return self.__idType
    
    def get_idSpectateur(self):
        return self.__idS
    
    def get_prix(self):
        return self.__prix
    
    def get_dateAchat(self):
        return self.__dateAchat
    
    def get_dateDebutB(self):
        return self.__dateDebutB
    
    def get_dateFinB(self):
        return self.__dateFinB
    
    def to_dict(self):
        return {
            "idB": self.__idB,
            "idF": self.__idF,
            "idType": self.__idType,
            "idS": self.__idS,
            "prix": self.__prix,
            "dateAchat": self.__dateAchat.isoformat(),
            "dateDebutB": self.__dateDebutB.isoformat(),
            "dateFinB": self.__dateFinB.isoformat()
        }
    
    
class Lieu:
    def __init__(self, idL: int, idF: int, nomL: str, adresseL: str, jaugeL: int):
        self.__idL = idL
        self.__idF = idF
        self.__nomL = nomL
        self.__adresseL = adresseL
        self.__jaugeL = jaugeL
        
    def get_idL(self):
        return self.__idL
    
    def get_idFestival(self):
        return self.__idF
    
    def get_nomL(self):
        return self.__nomL
    
    def get_adresseL(self):
        return self.__adresseL
    
    def get_jaugeL(self):
        return self.__jaugeL
    
    def to_dict(self):
        return {
            "idL": self.__idL,
            "idF": self.__idF,
            "nomL": self.__nomL,
            "adresseL": self.__adresseL,
            "jaugeL": self.__jaugeL
        }
    

class Hebergement:
    def __init__(self, idH: int, nomH: str, limitePlacesH: int, adresseH: int):
        self.__idH = idH
        self.__nomH = nomH
        self.__limitePlacesH = limitePlacesH
        self.__adresseH = adresseH
        
    def get_idH(self):
        return self.__idH
    
    def get_nomH(self):
        return self.__nomH
    
    def get_limitePlacesH(self):
        return self.__limitePlacesH
    
    def get_adresseH(self):
        return self.__adresseH
    
    def set_nomH(self, nomH):
        self.__nomH = nomH

    def set_limitePlacesH(self, limitePlacesH):
        self.__limitePlacesH = limitePlacesH

    def set_adresseH(self, adresseH):
        self.__adresseH = adresseH
    
    def to_dict(self):
        return {
            "idH": self.__idH,
            "nomH": self.__nomH,
            "limitePlacesH": self.__limitePlacesH,
            "adresseH": self.__adresseH
        }
    
class Programmer:
    def __init__(self, idF: int, idL: int, idH: int, dateArrivee: str, heureArrivee: str, dateDepart: str, heureDepart: str):
        self.__idF = idF
        self.__idL = idL
        self.__idH = idH
        self.__dateArrivee = dateArrivee if isinstance(dateArrivee, date) else datetime.strptime(dateArrivee, '%Y-%m-%d').date()
        self.__heureArrivee = self.timedelta_to_time(heureArrivee) if isinstance(heureArrivee, timedelta) else datetime.strptime(heureArrivee, '%H:%M').time()
        self.__dateDepart = dateDepart if isinstance(dateDepart, date) else datetime.strptime(dateDepart, '%Y-%m-%d').date()
        self.__heureDepart = self.timedelta_to_time(heureDepart) if isinstance(heureDepart, timedelta) else datetime.strptime(heureDepart, '%H:%M').time()
        
    @staticmethod
    def timedelta_to_time(td):
        return (datetime.min + td).time()
        
    def get_idFestival(self):
        return self.__idF
    
    def get_idLieu(self):
        return self.__idL
    
    def get_idHebergement(self):
        return self.__idH
    
    def get_dateArrivee(self):
        return self.__dateArrivee
    
    def get_heureArrivee(self):
        return self.__heureArrivee
    
    def get_dateDepart(self):
        return self.__dateDepart
    
    def get_heureDepart(self):
        return self.__heureDepart
    
    def to_dict(self):
        return {
            "idF": self.__idF,
            "idL": self.__idL,
            "idH": self.__idH,
            "dateArrivee": self.__dateArrivee.isoformat(),
            "heureArrivee": self.__heureArrivee.strftime("%H:%M:%S"),
            "dateDepart": self.__dateDepart.isoformat(),
            "heureDepart": self.__heureDepart.strftime("%H:%M:%S")
        }
    

class Groupe:
    def __init__(self, idG: int, idH: int, nomG: str, descriptionG: str):
        self.__idG = idG
        self.__idH = idH
        self.__nomG = nomG
        self.__descriptionG = descriptionG
        
    def get_idG(self):
        return self.__idG
    
    def get_idHebergement(self):
        return self.__idH
    
    def get_nomG(self):
        return self.__nomG
    
    def get_descriptionG(self):
        return self.__descriptionG
    
    def set_idHebergement(self, idH):
        self.__idH = idH
    
    def to_dict(self):
        return {
            "idG": self.__idG,
            "idH": self.__idH,
            "nomG": self.__nomG,
            "descriptionG": self.__descriptionG
        }
        
    def set_nomG(self, nomG):
        self.__nomG = nomG
        
    def set_descriptionG(self, descriptionG):
        self.__descriptionG = descriptionG
    

class Membre_Groupe:
    def __init__(self, idMG: int, idG, nomMG: str, prenomMG: str, nomDeSceneMG: str):
        self.__idMG = idMG
        self.__idG = idG
        self.__nomMG = nomMG
        self.__prenomMG = prenomMG
        self.__nomDeSceneMG = nomDeSceneMG
        
    def get_idMG(self):
        return self.__idMG
    
    def get_idGroupe(self):
        return self.__idG
    
    def get_nomMG(self):
        return self.__nomMG
    
    def get_prenomMG(self):
        return self.__prenomMG
    
    def get_nomDeSceneMG(self):
        return self.__nomDeSceneMG
    
    def __repr__(self):
        return f"({self.__idMG}, {self.__idG}, {self.__nomMG}, {self.__prenomMG}, {self.__nomDeSceneMG})"
    
    def to_dict(self):
        return {
            "idMG": self.__idMG,
            "idG": self.__idG,
            "nomMG": self.__nomMG,
            "prenomMG": self.__prenomMG,
            "nomDeSceneMG": self.__nomDeSceneMG
        }
    
    def set_nomMG(self, nomMG):
        self.__nomMG = nomMG
        
    def set_prenomMG(self, prenomMG):
        self.__prenomMG = prenomMG
        
    def set_nomDeSceneMG(self, nomDeSceneMG):
        self.__nomDeSceneMG = nomDeSceneMG
    
class Instrument:
    def __init__(self, idI: int, nomI: str):
        self.__idI = idI
        self.__nomI = nomI
        
    def get_idI(self):
        return self.__idI
    
    def get_nomI(self):
        return self.__nomI
    
    def to_dict(self):
        return {
            "idI": self.__idI,
            "nomI": self.__nomI
        }
    
class Style_Musical:
    def __init__(self, idSt: int, nomSt: str):
        self.__idSt = idSt
        self.__nomSt = nomSt
        
    def get_idSt(self):
        return self.__idSt
    
    def get_nomSt(self):
        return self.__nomSt
    
    def to_dict(self):
        return {
            "idSt": self.__idSt,
            "nomSt": self.__nomSt
        }
    
class Lien_Video:
    def __init__(self, idLV: int, idG: int, video: str):
        self.__idLV = idLV
        self.__idG = idG
        self.__video = video
        
    def get_idLV(self):
        return self.__idLV
    
    def get_idGroupe(self):
        return self.__idG
    
    def get_video(self):
        return self.__video
    
    def to_dict(self):
        return {
            "idLV": self.__idLV,
            "idG": self.__idG,
            "video": self.__video
        }
    
class Lien_Reseaux_Sociaux:
    def __init__(self, idLRS: int, idG: int, reseau: str):
        self.__idLRS = idLRS
        self.__idG = idG
        self.__reseau = reseau
        
    def get_idLRS(self):
        return self.__idLRS
    
    def get_idGroupe(self):
        return self.__idG
    
    def get_reseau(self):
        return self.__reseau
    
    def to_dict(self):
        return {
            "idLRS": self.__idLRS,
            "idG": self.__idG,
            "reseau": self.__reseau
        }
    
class Evenement:
    def __init__(self, idE: int, idG: int, idL: int, nomE: str, heureDebutE: str, heureFinE: str, dateDebutE: str, dateFinE: str):
        self.__idE = idE
        self.__idG = idG
        self.__idL = idL
        self.__nomE = nomE
        self.__heureDebutE = self.timedelta_to_time(heureDebutE) if isinstance(heureDebutE, timedelta) else datetime.strptime(heureDebutE, '%H:%M').time()
        self.__heureFinE = self.timedelta_to_time(heureFinE) if isinstance(heureFinE, timedelta) else datetime.strptime(heureFinE, '%H:%M').time()
        self.__dateDebutE = dateDebutE if isinstance(dateDebutE, date) else datetime.strptime(dateDebutE, "%Y-%m-%d").date()
        self.__dateFinE = dateFinE if isinstance(dateFinE, date) else datetime.strptime(dateFinE, "%Y-%m-%d").date()

    @staticmethod
    def timedelta_to_time(td):
        return (datetime.min + td).time()
        
    def get_idE(self):
        return self.__idE
    
    def get_idG(self):
        return self.__idG
    
    def get_idL(self):
        return self.__idL
    
    def get_nomE(self):
        return self.__nomE
    
    def get_heureDebutE(self):
        return self.__heureDebutE
    
    def get_heureFinE(self):
        return self.__heureFinE
    
    def get_dateDebutE(self):
        return self.__dateDebutE
    
    def get_dateFinE(self):
        return self.__dateFinE
    
    def set_idG(self, idG):
        self.__idG = idG
        
    def set_idL(self, idL):
        self.__idL = idL
    
    def set_nomE(self, nomE):
        self.__nomE = nomE
        
    def set_heureDebutE(self, heureDebutE):
        self.__heureDebutE = heureDebutE
        
    def set_heureFinE(self, heureFinE):
        self.__heureFinE = heureFinE
        
    def set_dateDebutE(self, dateDebutE):
        self.__dateDebutE = dateDebutE
        
    def set_dateFinE(self, dateFinE):
        self.__dateFinE = dateFinE
    
    def to_dict(self):
        return {
            "idE": self.__idE,
            "idG": self.__idG,
            "idL": self.__idL,
            "nomE": self.__nomE,
            "heureDebutE": self.__heureDebutE.strftime("%H:%M:%S") if self.__heureDebutE else None,
            "heureFinE": self.__heureFinE.strftime("%H:%M:%S") if self.__heureFinE else None,
            "dateDebutE": self.__dateDebutE.isoformat() if self.__dateDebutE else None,
            "dateFinE": self.__dateFinE.isoformat() if self.__dateFinE else None
        }
    
class Activite_Annexe:
    def __init__(self, idE: int, typeA: str, ouvertAuPublic: bool):
        self.__idE = idE
        self.__typeA = typeA
        self.__ouvertAuPublic = ouvertAuPublic
        
    def get_idEvenement(self):
        return self.__idE
    
    def get_typeA(self):
        return self.__typeA
    
    def get_ouvertAuPublic(self):
        return self.__ouvertAuPublic
    
    def to_dict(self):
        return {
            "idE": self.__idE,
            "typeA": self.__typeA,
            "ouvertAuPublic": self.__ouvertAuPublic
        }
    
class Concert:
    def __init__(self, idE: int, tempsMontage: str, tempsDemontage: str):
        self.__idE = idE
        self.__tempsMontage = self.timedelta_to_time(tempsMontage) if isinstance(tempsMontage, timedelta) else datetime.strptime(tempsMontage, '%H:%M').time()
        self.__tempsDemontage = self.timedelta_to_time(tempsDemontage) if isinstance(tempsDemontage, timedelta) else datetime.strptime(tempsDemontage, '%H:%M').time()
        
    @staticmethod
    def timedelta_to_time(td):
        return (datetime.min + td).time()
    
    def get_idEvenement(self):
        return self.__idE
    
    def get_tempsMontage(self):
        return self.__tempsMontage
    
    def get_tempsDemontage(self):
        return self.__tempsDemontage

    def to_dict(self):
        return {
            "idE": self.__idE,
            "tempsMontage": self.__tempsMontage.strftime("%H:%M:%S"),
            "tempsDemontage": self.__tempsDemontage.strftime("%H:%M:%S")
        }

class Groupe_Style:
    def __init__(self, idG: int, idSt: int):
        self.__idG = idG
        self.__idSt = idSt
        
    def get_idG(self):
        return self.__idG
    
    def get_idSt(self):
        return self.__idSt
    
    def to_dict(self):
        return {
            "idG": self.__idG,
            "idSt": self.__idSt
        }