<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/minilesson/db" VERSION="20251209" COMMENT="XMLDB file for Moodle mod/minilesson"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>
    <TABLE NAME="minilesson" COMMENT="Default comment for minilesson, please edit me">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" />
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Course minilesson activity belongs to" />
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name field for moodle instances" />
        <FIELD NAME="intro" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the minilesson activity" />
        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)"/>
        <FIELD NAME="grade" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="gradeoptions" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0"  SEQUENCE="false" COMMENT="gradeoptions" />
        <FIELD NAME="maxattempts" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="maxattempts" />
        <FIELD NAME="mingrade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="completion condition mingrade" />
        <FIELD NAME="ttslanguage" TYPE="char" LENGTH="255" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="none" COMMENT="the audio filename"/>
        <FIELD NAME="transcriber" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" COMMENT="transcriber"/>
        <FIELD NAME="region" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" DEFAULT="useast1" COMMENT="aws region" />
        <FIELD NAME="activitylink" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="pagelayout" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="embedded" SEQUENCE="false"/>
        <FIELD NAME="showqtitles" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
        <FIELD NAME="showitemreview" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
        <FIELD NAME="richtextprompt" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="foriframe" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="intended to be iframed"/>
        <FIELD NAME="lessonkey" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="An identifier for the lesson that reports may use"/>
        <FIELD NAME="csskey" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="A custom css identifier that can be added to the quiz container"/>
        <FIELD NAME="containerwidth" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" DEFAULT="compact" COMMENT="An identifier for the lesson that reports may use"/>
        <FIELD NAME="lessonfont" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="lesson font" />
        <FIELD NAME="finishscreen" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="finishscreen"/>
        <FIELD NAME="finishscreencustom" TYPE="text" LENGTH="big" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Custom information required for finish screen"/>
        <FIELD NAME="completionwhenfinished" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" />
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"/>
		<FIELD NAME="viewstart" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="viewend" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="nativelang" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
      </INDEXES>
    </TABLE>
	 <TABLE NAME="minilesson_attempt" COMMENT="user attempt data for minilesson">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" />
        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Course minilesson activity belongs to" />
		<FIELD NAME="moduleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="minilesson activity this data belongs to" />
		<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Course minilesson activity belongs to" />
        <FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="status " />
        <FIELD NAME="sessiontime" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" />
        <FIELD NAME="sessiondata" TYPE="text" LENGTH="8192" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="json string of errors"/>
		<FIELD NAME="sessionend" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" />
        <FIELD NAME="sessionscore" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="errorcount" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="notes" TYPE="text" LENGTH="8192" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Notes"/>
        <FIELD NAME="qtextanswer1" TYPE="text" LENGTH="8192" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="qtextscore1" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
		<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" />
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="minilesson_rsquestions" COMMENT="minilesson_items table retrofitted from MySQL">
        <FIELDS>
            <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
            <FIELD NAME="minilesson" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemorder" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="type" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="visible" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="1" SEQUENCE="false"/>
            <FIELD NAME="iteminstructions" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemtext" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemtextformat" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="itemtts" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemttsvoice" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemttsoption" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="itemtextarea" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemttsautoplay" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="itemytid" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemytstart" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="itemytend" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="itemaudiofname" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemaudiostoryzoom" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="itemttsdialog" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemttsdialogopts" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemttspassage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="itemttspassageopts" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext1" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext1format" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext2" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext2format" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customtext3" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext3format" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customtext4" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext4format" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customtext5" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext5format" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customtext6" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext6format" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customtext7" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customtext7format" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customdata1" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customdata2" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customdata3" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customdata4" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customdata5" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="customint1" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint2" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint3" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint4" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint5" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint6" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint7" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint8" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint9" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="customint10" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="layout" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="correctanswer" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="passagehash" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="hash for DS lang model" />
            <FIELD NAME="alternatives" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Alternatives"/>
            <FIELD NAME="phonetic" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Phonetic"/>
            <FIELD NAME="rsquestionkey" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="" />
            <FIELD NAME="timelimit" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0"  SEQUENCE="false" />
            <FIELD NAME="createdby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
            <FIELD NAME="modifiedby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        </FIELDS>
        <KEYS>
            <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        </KEYS>
    </TABLE>
    <TABLE NAME="minilesson_auth" COMMENT="Stores tokens for authenticating users for different actions">
          <FIELDS>
              <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
              <FIELD NAME="user_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Id of the user that created the token"/>
              <FIELD NAME="created_at" TYPE="int" LENGTH="11" NOTNULL="true" SEQUENCE="false" COMMENT="Timestamp for when token was created"/>
              <FIELD NAME="secret" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" COMMENT="Secret used to generate the authentication token"/>
          </FIELDS>
          <KEYS>
              <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
          </KEYS>
          <INDEXES>
              <INDEX NAME="user_id" UNIQUE="true" FIELDS="user_id"/>
          </INDEXES>
    </TABLE>
    <TABLE NAME="minilesson_templates" COMMENT="Stores minilesson templates">
        <FIELDS>
            <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
            <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
            <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
            <FIELD NAME="config" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
            <FIELD NAME="template" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
            <FIELD NAME="uniqueid" TYPE="char" LENGTH="250" NOTNULL="true" SEQUENCE="false"/>
            <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
            <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
            <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        </FIELDS>
        <KEYS>
            <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
            <KEY NAME="uniquniqueid" TYPE="unique" FIELDS="uniqueid"/>
        </KEYS>
        </TABLE>
      <TABLE NAME="minilesson_template_usages" COMMENT="Stores template usages">
          <FIELDS>
              <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
              <FIELD NAME="minilessonid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="contextdata" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="progress" TYPE="number" LENGTH="3" NOTNULL="false" SEQUENCE="false" DECIMALS="2"/>
              <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
              <FIELD NAME="error" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
          </FIELDS>
          <KEYS>
              <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
              <KEY NAME="fkminilessonid" TYPE="foreign" FIELDS="minilessonid" REFTABLE="minilesson" REFFIELDS="id"/>
              <KEY NAME="fktemplateid" TYPE="foreign" FIELDS="templateid" REFTABLE="minilesson_templates" REFFIELDS="id"/>
          </KEYS>
      </TABLE>
      <TABLE NAME="minilesson_template_tags" COMMENT="Stores template tags">
          <FIELDS>
              <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
              <FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="tagname" TYPE="char" LENGTH="700" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="type" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false" COMMENT="1 for single/multiple-item, 2 for item type, 3 for predefined type"/>
              <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
              <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
          </FIELDS>
          <KEYS>
              <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
              <KEY NAME="fktemplateid" TYPE="foreign" FIELDS="templateid" REFTABLE="minilesson_templates" REFFIELDS="id"/>
          </KEYS>
      </TABLE>
  </TABLES>
</XMLDB>
