// To parse this JSON data, do
//
//     final quizQuestion = quizQuestionFromJson(jsonString);

import 'dart:convert';

QuizQuestion quizQuestionFromJson(String str) =>
    QuizQuestion.fromJson(json.decode(str));

String quizQuestionToJson(QuizQuestion data) => json.encode(data.toJson());

class QuizQuestion {
  final List<Datum> data;

  QuizQuestion({
    required this.data,
  });

  factory QuizQuestion.fromJson(Map<String, dynamic> json) => QuizQuestion(
        data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "data": List<dynamic>.from(data.map((x) => x.toJson())),
      };
}

class Datum {
  final String id;
  final String quizId;
  final String title;
  final String type;
  final String numberOption;
  final List<String> options;
  final List<String> correctAnswers;
  final String order;

  Datum({
    required this.id,
    required this.quizId,
    required this.title,
    required this.type,
    required this.numberOption,
    required this.options,
    required this.correctAnswers,
    required this.order,
  });

  factory Datum.fromJson(Map<String, dynamic> json) => Datum(
        id: json["id"],
        quizId: json["quiz_id"],
        title: json["title"],
        type: json["type"],
        numberOption: json["number_option"],
        options: List<String>.from(json["options"].map((x) => x)),
        correctAnswers:
            List<String>.from(json["correct_answers"].map((x) => x)),
        order: json["order"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "quiz_id": quizId,
        "title": title,
        "type": type,
        "number_option": numberOption,
        "options": List<dynamic>.from(options.map((x) => x)),
        "correct_answers": List<dynamic>.from(correctAnswers.map((x) => x)),
        "order": order,
      };
}
