export type Groupe = "Entrainement" | "Competition" | "Loisir"| ""; export type Role = "admin" | "athlete" | "coach"; export class User{ id!: number; keycloakId!: String; nom!: string; prenom!:string; sessions: Session[] = []; //nb: Admin liaison non symétrique /!\ email!: string; role!: Role; } export class Ligne{ id!: number; nom!: string; composition!: Athlete[] //les joueurs compososant la ligne tempsDeJeu!: number; // en minutes } export class Admin extends User{ role!: Role; } export class Athlete extends User{ nom!: string; groupe!: Groupe; role!: Role; } export class Coach extends User{ nom!: string; role!: Role; } export class Session{ id!: number; name!: string; activites: Activite[] = []; isRecurrent! : Boolean; creneau!: Date; coach!: Coach; athletes!: Athlete[] duree! : number; groupe! : Groupe; ligne! : Ligne[]; } export class Activite{ id!: number; nom!: string; session!: Session; theme!: string; data!: Map; duree!: number; } export function getUserTest():User{ const user = new User(); const s1 = new Session(); const s2 = new Session(); const s3 = new Session(); const athlete1 = new Athlete(); athlete1.id = 1; athlete1.nom = "Alice Dupont"; athlete1.email = "alice@nootnoot.yee"; athlete1.groupe = "Entrainement"; const athlete2 = new Athlete(); athlete2.id = 2; athlete2.nom = "Bob Martin"; athlete2.groupe = "Competition"; const athlete3 = new Athlete(); athlete3.id = 3; athlete3.nom = "Clara Lopez"; athlete3.groupe = "Loisir"; const ligne1 = new Ligne(); ligne1.id = 1; ligne1.nom = "Ligne A"; ligne1.composition = [athlete1, athlete2]; // Alice + Bob ligne1.tempsDeJeu = 45; const ligne2 = new Ligne(); ligne2.id = 2; ligne2.nom = "Ligne B"; ligne2.composition = [athlete2, athlete3]; // Bob + Clara ligne2.tempsDeJeu = 40; const ligne3 = new Ligne(); ligne3.id = 3; ligne3.nom = "Ligne C"; ligne3.composition = [athlete1, athlete3]; // Alice + Clara ligne3.tempsDeJeu = 50; user.id = 0; user.nom = "Emilien-Yee NootNoot"; user.role = "coach" user.email = "emilien@nootnoot.yee"; s1.creneau = new Date(); s1.id = 1; s1.name = "Entrainement Frisbee" s1.isRecurrent = true; s1.ligne = [ligne1]; s1.duree= 90; s1.athletes = [athlete1,athlete2]; var date2 = new Date(); date2.setDate(date2.getDate() + 2); s2.creneau = date2; s2.id = 2; s2.isRecurrent = false; s2.name = "entraintement 2" s2.ligne = [ligne2]; s2.duree= 120; s2.athletes = [athlete1,athlete2, athlete3]; s3.creneau = date2; s3.id = 3; s3.isRecurrent = false; s3.name = "entraintement 3" s3.ligne = [ligne3, ligne1]; s3.duree= 120; s3.athletes = [athlete2, athlete3]; const act1 = new Activite(); act1.id = 1; act1.nom = "Échauffement"; act1.theme = "Cardio"; act1.duree = 15; act1.session = s1; act1.data = new Map([["objectif", "Préparer le corps"], ["matériel", "Ballon"]]); const act2 = new Activite(); act2.id = 2; act2.nom = "Dribbles et passes"; act2.theme = "Technique"; act2.duree = 30; act2.session = s1; act2.data = new Map([["objectif", "Améliorer les passes"], ["niveau", "Intermédiaire"]]); const act3 = new Activite(); act3.id = 3; act3.nom = "Renforcement musculaire"; act3.theme = "Force"; act3.duree = 25; act3.session = s2; act3.data = new Map([["objectif", "Renforcer les jambes"], ["matériel", "Haltères"]]); const act4 = new Activite(); act4.id = 4; act4.nom = "Sprint et agilité"; act4.theme = "Vitesse"; act4.duree = 20; act4.session = s2; act4.data = new Map([["objectif", "Améliorer les sprints"], ["matériel", "Plots"]]); const act5 = new Activite(); act5.id = 5; act5.nom = "Match 5v5"; act5.theme = "Jeu"; act5.duree = 60; act5.session = s3; act5.data = new Map([["objectif", "Appliquer les techniques"], ["niveau", "Avancé"]]); const act6 = new Activite(); act6.id = 6; act6.nom = "Étirements"; act6.theme = "Récupération"; act6.duree = 10; act6.session = s3; act6.data = new Map([["objectif", "Éviter les blessures"], ["matériel", "Tapis"]]); // attach the concrete activities to their sessions s1.activites.push(act1); s1.activites.push(act2); s2.activites.push(act3); s2.activites.push(act4); s2.activites.push(act5); s2.activites.push(act6); user.sessions.push(s1); user.sessions.push(s2); user.sessions.push(s3); athlete1.role = "athlete"; athlete2.role = "athlete"; athlete3.role = "athlete"; return user; }