-- Ajout des rôles
INSERT INTO role (nom)
VALUES ('Administrateur'),
       ('Enseignant'),
       ('Étudiant');

-- Ajout des utilisateurs
INSERT INTO utilisateur (login, mot_de_passe, nom, prenom, email)
VALUES ('jlpicar', 'password', 'Picard', 'Jean-Luc', 'jean-luc.picard@starfleet.com'),
       ('kjaneway', 'password', 'Janeway', 'Kathryn', 'kathryn.janeway@starfleet.com'),
       ('spock', 'password', '', 'Spock', 'spock@starfleet.com'),
       ('wriker', 'password', 'Riker', 'William', 'william.riker@starfleet.com'),
       ('data', 'password', '', 'Data', 'data@starfleet.com'),
       ('glaforge', 'password', 'LaForge', 'Geordi', 'geordi.laforge@starfleet.com'),
       ('tuvok', 'password', 'Tuvok', '', 'tuvok@starfleet.com'),
       ('wcrusher', 'password', 'Crusher', 'Wesley', 'wesley.crusher@starfleet.com'),
       ('tparis', 'password', 'Paris', 'Tom', 'tom.paris@starfleet.com'),
       ('hkim', 'password', 'Kim', 'Harry', 'harry.kim@starfleet.com'),
       ('jsisko', 'password', 'Sisko', 'Jake', 'jake.sisko@starfleet.com'),
       ('nog', 'password', '', 'Nog', 'nog@starfleet.com'),
       ('bmariner', 'password', 'Mariner', 'Beckett', 'beckett.mariner@starfleet.com'),
       ('bboimler', 'password', 'Boimler', 'Brad', 'brad.boimler@starfleet.com'),
       ('dvtendi', 'password', 'Tendi', 'D''Vana', 'd-vana.tendi@starfleet.com'),
       ('srutherf', 'password', 'Rutherford', 'Sam', 'sam.rutherford@starfleet.com'),
       ('drel', 'password', 'R''El', 'Dal', 'dal.r-el@starfleet.com'),
       ('gwyndala', 'password', '', 'Gwyndala', 'gwyndala@starfleet.com'),
       ('roktahk', 'password', '', 'Rok-Tahk', 'rok-takh@starfleet.com'),
       ('zero', 'password', 'Zero', '', 'zero@starfleet.com'),
       ('jpog', 'password', 'Pog', 'Jankom', 'jankom.pog@starfleet.com'),
       ('murf', 'password', '', 'Murf', 'murf@starfleet.com');

-- Ajout des rôles aux utilisateurs
INSERT INTO utilisateur_role (utilisateur_id, role_id)
VALUES ((select id from utilisateur where login = 'jlpicar'), 1),  -- Picard as Administrator
       ((select id from utilisateur where login = 'kjaneway'), 1), -- Janeway as Administrator
       ((select id from utilisateur where login = 'spock'), 2),    -- Spock as Teacher
       ((select id from utilisateur where login = 'wriker'), 2),   -- Riker as Teacher
       ((select id from utilisateur where login = 'data'), 2),     -- Data as Teacher
       ((select id from utilisateur where login = 'glaforge'), 2), -- LaForge as Teacher
       ((select id from utilisateur where login = 'tuvok'), 2),    -- Tuvok as Teacher
       ((select id from utilisateur where login = 'wcrusher'), 3), -- Crusher as Student
       ((select id from utilisateur where login = 'tparis'), 3),   -- Paris as Student
       ((select id from utilisateur where login = 'hkim'), 3),     -- Kim as Student
       ((select id from utilisateur where login = 'jsisko'), 3),   -- Sisko as Student
       ((select id from utilisateur where login = 'nog'), 3),      -- Nog as Student
       ((select id from utilisateur where login = 'bmariner'), 3), -- Mariner as Student
       ((select id from utilisateur where login = 'bboimler'), 3), -- Boimler as Student
       ((select id from utilisateur where login = 'dvtendi'), 3),  -- Tendi as Student
       ((select id from utilisateur where login = 'srutherf'), 3), -- Rutherford as Student
       ((select id from utilisateur where login = 'drel'), 3),     -- R'El as Student
       ((select id from utilisateur where login = 'gwyndala'), 3), -- Gwyndala as Student
       ((select id from utilisateur where login = 'roktahk'), 3),  -- Rok-Tahk as Student
       ((select id from utilisateur where login = 'zero'), 3),     -- Zero as Student
       ((select id from utilisateur where login = 'jpog'), 3),     -- Pog as Student
       ((select id from utilisateur where login = 'murf'), 3);
-- Murf as Student

-- Ajout des cours
INSERT INTO cours (nom, date_debut)
VALUES ('Starship Command', '2023-01-01'),
       ('Warp Theory', '2023-02-01'),
       ('Federation Ethics', '2023-03-01');

-- Ajout des enseignements
INSERT INTO enseignement (utilisateur_id, cours_id)
VALUES ((select id from utilisateur where login = 'spock'), 1),    -- Spock teaches Starship Command
       ((select id from utilisateur where login = 'wriker'), 1),   -- Riker teaches Starship Command
       ((select id from utilisateur where login = 'data'), 2),     -- Data teaches Warp Theory
       ((select id from utilisateur where login = 'glaforge'), 2), -- LaForge teaches Warp Theory
       ((select id from utilisateur where login = 'tuvok'), 3);
-- Tuvok teaches Federation Ethics

-- Ajout des inscriptions
INSERT INTO inscription (utilisateur_id, cours_id)
VALUES ((select id from utilisateur where login = 'wcrusher'), 1), -- Crusher enrolls in Starship Command
       ((select id from utilisateur where login = 'wcrusher'), 2), -- Crusher enrolls in Warp Theory
       ((select id from utilisateur where login = 'tparis'), 1),   -- Paris enrolls in Starship Command
       ((select id from utilisateur where login = 'hkim'), 1),     -- Kim enrolls in Starship Command
       ((select id from utilisateur where login = 'jsisko'), 3),   -- Sisko enrolls in Federation Ethics
       ((select id from utilisateur where login = 'nog'), 1),      -- Nog enrolls in Starship Command
       ((select id from utilisateur where login = 'nog'), 3),      -- Nog enrolls in Federation Ethics
       ((select id from utilisateur where login = 'bboimler'), 1), -- Boimler enrolls in Starship Command
       ((select id from utilisateur where login = 'dvtendi'), 2),  -- Tendi enrolls in Warp Theory
       ((select id from utilisateur where login = 'srutherf'), 2), -- Rutherford enrolls in Warp Theory
       ((select id from utilisateur where login = 'drel'), 1),     -- R'El enrolls in Starship Command
       ((select id from utilisateur where login = 'gwyndala'), 1), -- Gwyndala enrolls in Starship Command
       ((select id from utilisateur where login = 'gwyndala'), 3), -- Gwyndala enrolls in Federation Ethics
       ((select id from utilisateur where login = 'roktahk'), 2),  -- Rok-Tahk enrolls in Warp Theory
       ((select id from utilisateur where login = 'zero'), 3),     -- Zero enrolls in Federation Ethics
       ((select id from utilisateur where login = 'jpog'), 2);
-- Pog enrolls in Warp Theory

-- Ajout des contenus de cours
INSERT INTO contenu_cours (cours_id, titre, description)
VALUES (1, 'Bridge Operations', 'Learn how to manage starship operations.'),
       (1, 'Tactical Maneuvers', 'Advanced starship tactics.'),
       (1, 'Command Decision Making', 'Develop leadership skills for commanding a starship.'),
       (2, 'Warp Core Mechanics', 'Understand the inner workings of warp cores.'),
       (2, 'Dilithium Crystals', 'Study the properties of dilithium crystals.'),
       (2, 'Warp Field Theory', 'Explore the physics behind warp travel.'),
       (3, 'Prime Directive', 'Ethical dilemmas in space exploration.'),
       (3, 'Cultural Sensitivity', 'Learn how to interact with alien civilizations.'),
       (3, 'Federation Law', 'Understand the legal framework of the Federation.');

-- Ajout des devoirs
INSERT INTO devoir (cours_id, titre, description, date_debut, date_fin)
VALUES (1, 'Bridge Simulation', 'Participate in a simulated bridge operation.', '2023-01-15', '2023-01-30'),
       (1, 'Tactical Exercise', 'Plan and execute tactical maneuvers.', '2023-01-20', '2023-02-05'),
       (2, 'Warp Core Analysis', 'Analyze the efficiency of a warp core.', '2023-02-10', '2023-02-25'),
       (2, 'Crystal Experiment', 'Experiment with dilithium crystals.', '2023-02-15', '2023-03-01'),
       (3, 'Prime Directive Case Study', 'Discuss ethical dilemmas.', '2023-03-10', '2023-03-25');
