<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/interactivevideo/db" VERSION="20250924" COMMENT="XMLDB file for Moodle mod/interactivevideo"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>
    <TABLE NAME="interactivevideo" COMMENT="Stores the interactivevideo activity module instances.">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of the course this activity is part of."/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The name of the activity module instance"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Timestamp of when the instance was added to the course."/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Timestamp of when the instance was last modified."/>
        <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Activity description."/>
        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the intro field."/>
        <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="video source: url or file"/>
        <FIELD NAME="videourl" TYPE="char" LENGTH="1333" NOTNULL="false" SEQUENCE="false" COMMENT="The video url"/>
        <FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The video url type"/>
        <FIELD NAME="video" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The video file"/>
        <FIELD NAME="endscreentext" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="End screen description."/>
        <FIELD NAME="displayasstartscreen" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="starttime" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="2"/>
        <FIELD NAME="endtime" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="2"/>
        <FIELD NAME="completionpercentage" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="displayoptions" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="display options object"/>
        <FIELD NAME="posterimage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="extendedcompletion" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="fk_course" TYPE="foreign" FIELDS="course" REFTABLE="course" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="interactivevideo_items" COMMENT="Store interactive items on the video">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="courseid" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="cmid" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="annotationid" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timestamp" TYPE="number" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="2"/>
        <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="iframeurl" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="content" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="xp" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="XP"/>
        <FIELD NAME="displayoptions" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="popup" SEQUENCE="false"/>
        <FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="richtext" SEQUENCE="false"/>
        <FIELD NAME="contentid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="hascompletion" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="completiontracking" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="manual" SEQUENCE="false"/>
        <FIELD NAME="advanced" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Store advanced settings as stringified json."/>
        <FIELD NAME="intg1" TYPE="int" LENGTH="20" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="intg2" TYPE="int" LENGTH="20" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="intg3" TYPE="int" LENGTH="20" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="char1" TYPE="char" LENGTH="255" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="char2" TYPE="char" LENGTH="255" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="char3" TYPE="char" LENGTH="255" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="text1" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="text2" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="text3" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="contextid" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="requiremintime" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
        <KEY NAME="cmid" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id"/>
        <KEY NAME="annotationid" TYPE="foreign" FIELDS="annotationid" REFTABLE="interactivevideo" REFFIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="contextid" UNIQUE="false" FIELDS="contextid"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="interactivevideo_completion" COMMENT="Store user progress per cmid">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timecompleted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timeended" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="Time the user watched video till the end"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="course module"/>
        <FIELD NAME="xp" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="XP"/>
        <FIELD NAME="completeditems" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="array of completed annotation ids"/>
        <FIELD NAME="completionpercentage" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="completiondetails" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="JSON formatted completion details"/>
        <FIELD NAME="lastviewed" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
        <KEY NAME="cmid" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="interactivevideo_log" COMMENT="Store user data per interaction item">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="course module"/>
        <FIELD NAME="annotationid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="completionid" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="id of associated interactive_completion record"/>
        <FIELD NAME="attachments" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="For filemanager named attachments"/>
        <FIELD NAME="intg1" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
        <FIELD NAME="intg2" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
        <FIELD NAME="intg3" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
        <FIELD NAME="intg4" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="intg5" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="intg6" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="char1" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name"/>
        <FIELD NAME="char2" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name"/>
        <FIELD NAME="char3" TYPE="char" LENGTH="1333" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name"/>
        <FIELD NAME="char4" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="char5" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="char6" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="text1" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
        <FIELD NAME="text2" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
        <FIELD NAME="text3" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
        <KEY NAME="cmid" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id"/>
        <KEY NAME="annotationid" TYPE="foreign" FIELDS="annotationid" REFTABLE="interactivevideo_items" REFFIELDS="id"/>
        <KEY NAME="completionid" TYPE="foreign" FIELDS="completionid" REFTABLE="interactivevideo_completion" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="interactivevideo_settings" COMMENT="Default settings per specific course, overriding site defaults.">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="courseid" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="endscreentext" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="displayasstartscreen" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="completionpercentage" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="displayoptions" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="extendedcompletion" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="completion" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="defaults" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Store interaction defaults per course."/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="courseid" UNIQUE="true" FIELDS="courseid"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="interactivevideo_defaults" COMMENT="Store default settings for interactive items per course.">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="courseid" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timestamp" TYPE="number" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="2"/>
        <FIELD NAME="content" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="xp" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="XP"/>
        <FIELD NAME="displayoptions" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="popup" SEQUENCE="false"/>
        <FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="richtext" SEQUENCE="false"/>
        <FIELD NAME="hascompletion" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="completiontracking" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="manual" SEQUENCE="false"/>
        <FIELD NAME="advanced" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Store advanced settings as stringified json."/>
        <FIELD NAME="intg1" TYPE="int" LENGTH="20" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="intg2" TYPE="int" LENGTH="20" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="intg3" TYPE="int" LENGTH="20" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="char1" TYPE="char" LENGTH="255" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="char2" TYPE="char" LENGTH="255" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="char3" TYPE="char" LENGTH="255" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
        <FIELD NAME="text1" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="text2" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="text3" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="requiremintime" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
  </TABLES>
</XMLDB>
