comment avoir les question d'un quizz dans getQuestions : $pdo->exec("
    CREATE TABLE IF NOT EXISTS quizzes (
        id INTEGER PRIMARY KEY,
        name TEXT NOT NULL
    )
");

try {
    $pdo->exec("
        CREATE TABLE IF NOT EXISTS questions (
            uuid TEXT PRIMARY KEY,
            quiz_id INTEGER,
            type TEXT NOT NULL,
            label TEXT NOT NULL,
            choices TEXT,
            correct TEXT NOT NULL,
            FOREIGN KEY (quiz_id) REFERENCES quizzes(id)
        )
    ");$quizzes = json_decode(file_get_contents('data.json'), true);

foreach ($quizzes as $quiz) {
    // je regarde si le quizz existe déjà (car si je execute le php il voudra insert et j'aurais un constraint fail)
    $stmt = $pdo->prepare("SELECT * FROM quizzes WHERE id = ?");
    $stmt->execute([$quiz['quiz_id']]);
    $exists = $stmt->fetch(PDO::FETCH_ASSOC);

    // si le quizz n'existe pas, je l'insert donc
    if (!$exists) {
        $pdo->prepare("
            INSERT INTO quizzes (id, name) VALUES (?, ?)
        ")->execute([
            $quiz['quiz_id'],
            $quiz['quiz_name'],
        ]);
    }

    foreach ($quiz['questions'] as $question) {
        $question['quiz_id'] = $quiz['quiz_id']; // je ne comprend pas pourquoi je n'ai pas la clé étrangère
                                                // quiz_id dans mon tableau question alors que dans la table de la bd 
                                                // j'ai bien la clé étrangère quiz_id
    
        $stmt = $pdo->prepare("SELECT * FROM questions WHERE uuid = ?");
        $stmt->execute([$question['uuid']]);
        $exists = $stmt->fetch(PDO::FETCH_ASSOC);
    
        // meme chose pour les questions
        if (!$exists) {
            $pdo->prepare("
                INSERT INTO questions (uuid, type, label, choices, correct) VALUES (?, ?, ?, ?, ?)
            ")->execute([
                $question['uuid'],
                $question['type'],
                $question['label'],
                isset($question['choices']) ? json_encode($question['choices']) : null,
                is_array($question['correct']) ? json_encode($question['correct']) : $question['correct'],
            ]);function getQuestions($quiz_id) {
    $pdo = new PDO('sqlite:db.sqlite');
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $stmt = $pdo->prepare("SELECT * FROM questions WHERE quiz_id = ?");
    $stmt->execute([$quiz_id]);
    $datas = $stmt->fetchAll(PDO::FETCH_ASSOC);

    $questions = [];

    foreach ($datas as $data) {
        $question = null;
        $uuid = $data['uuid'];
        $type = $data['type'];
        $label = $data['label'];
        $choices = json_decode($data['choices'], true);
        $correct = is_array(json_decode($data['correct'], true)) ? json_decode($data['correct'], true) : $data['correct'];

        switch ($type) {
            case 'radio':
                $question = new RadioQuestion($uuid, $type, $label, $choices, $correct);
                break;
            case 'checkbox':
                $question = new CheckboxQuestion($uuid, $type, $label, $choices, $correct);
                break;
            case 'text':
                $question = new TextQuestion($uuid, $type, $label, $correct);
                break;
        }
        if ($question !== null) {
            $questions[] = $question;
        }
    }

    return $questions;
}