<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/kopere_dashboard/plugins/contracts/db" VERSION="2026030500" COMMENT="Contracts tables"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd">
    <TABLES>
        <TABLE NAME="koperedashboard_contracts" COMMENT="Contracts master table.">
            <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="summary" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
                <FIELD NAME="content" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="contentformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
                <FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" 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"/>
            </KEYS>
            <INDEXES>
                <INDEX NAME="idx_active" UNIQUE="false" FIELDS="active"/>
            </INDEXES>
        </TABLE>
        <TABLE NAME="koperedashboard_contract_courses" COMMENT="Contract to course mapping.">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
                <FIELD NAME="contractid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
            </KEYS>
            <INDEXES>
                <INDEX NAME="idx_contract_course" UNIQUE="true" FIELDS="contractid,courseid"/>
            </INDEXES>
        </TABLE>
        <TABLE NAME="koperedashboard_contract_accept" COMMENT="Contract acceptance signatures by user.">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
                <FIELD NAME="contractid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="timeaccepted" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="ip" TYPE="char" LENGTH="45" NOTNULL="false" SEQUENCE="false"/>
                <FIELD NAME="useragent" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
                <FIELD NAME="readseconds" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
            </KEYS>
            <INDEXES>
                <INDEX NAME="idx_contract_user_course" UNIQUE="true" FIELDS="contractid,userid,courseid"/>
            </INDEXES>
        </TABLE>
    </TABLES>
</XMLDB>
