// LessonTypes stores different types of lessons
Table LessonTypes {
  // system field
  id int [pk, increment] // unique identifier for the lesson type
  created datetime [default: `now()`] // timestamp when the lesson type was created
  updated datetime // timestamp when the lesson type was last updated
  // value field
  name varchar // name of the lesson type
  type varchar // type category
}

// LessonCategories stores categories of lessons
Table LessonCategories {
  // system field
  id int [pk, increment] // unique identifier for the lesson category
  created datetime [default: `now()`] // timestamp when the category was created
  updated datetime // timestamp when the category was last updated
  // value field
  cat_name varchar // image file name
  cat_image varchar // image representing the category
  lesson_type_id integer [ref: > LessonTypes.id] // foreign key referencing LessonTypes.id
}

Table Helloworlds {
  // system field
  id int [pk, increment] // id field, increment
  created datetime [default: `now()`] // record create time
  updated datetime // record update time
}

Table Users {
  // system field
  id int [pk, increment]
  created datetime [default: `now()`]
  updated datetime

  // value field
  email varchar
  emailVisibility boolean
  verified boolean
  name varchar
  avatar blob
}

Table UserMetas {
  // system field
  id int [pk, increment]
  created datetime [default: `now()`]
  updated datetime

  // value field
  helloworld varchar
  app_on_time_s integer
  user_id integer [ref: > Users.id]
}

Table QuizCategories {
  // system field
  id int [pk, increment]
  created datetime [default: `now()`]
  updated datetime

  // value field
  cat_name varchar // category name
  cat_image varchar // category image
}

// stores all questions of matching frenzy
Table QuizMatchings {
  // system field
  id int [pk, increment] // id field, increment
  created datetime [default: `now()`] // record create time
  updated datetime // record update time

  // value field
  word varchar // modal answer
  word_c varchar // question
  cat_id integer [ref: > QuizCategories.id] // foreign key to QuizCategories.id
}

// QuizListening stores all listening quiz data
Table QuizListenings {
  // system field
  id int [pk, increment] // id field, increment
  created datetime [default: `now()`] // record create time
  updated datetime // record update time

  // value field
  sound varchar // URL to the sound file
  word varchar // The word in the quiz
  cat_id integer [ref: > QuizCategories.id]
}

// stores all categories of connectives revision quiz
Table QuizConnectivesCategories {
  // system field
  id int [pk, increment] // id field, increment
  created datetime [default: `now()`] // record create time
  updated datetime // record update time

  // value field
  cat_name varchar // category name
  cat_image varchar // category image
}

// stores all questions of connectives revision quiz
Table QuizConnectives {
  // system field
  id int [pk, increment] // id field, increment
  created datetime [default: `now()`] // record create time
  updated datetime // record update time

  // value field
  question_fh varchar // first half
  question_sh varchar // second half
  modal_ans varchar // modal ans
  cat_id integer [ref: > QuizConnectivesCategories.id] // foreign key to QuizConnectivesCategories.id
}

// Lessons stores all lessons in the database
Table Vocabularies {
  // system field
  id int [pk, increment] // unique identifier for the lesson
  created datetime [default: `now()`] // timestamp when the lesson was created
  updated datetime // timestamp when the lesson was last updated

  // value field
  image varchar // URL to the image associated with the lesson
  sound varchar // URL to the sound file associated with the lesson
  word varchar // The word in English
  word_c varchar // The word in Chinese
  sample_e varchar // Sample sentence in English using the word
  sample_c varchar // Sample sentence in Chinese using the word
  cat_id integer [ref: > LessonCategories.id] // foreign key referring to LessonCategories.id
  category varchar // The category to which the lesson belongs
}

