<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/kopere_dashboard/plugins/requests/db" VERSION="2026030500" COMMENT="Kopere Dashboard requests tables"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd">
    <TABLES>

        <TABLE NAME="koperedashboard_req_category" COMMENT="Request categories.">
            <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="false" SEQUENCE="false"/>
                <FIELD NAME="allowteacher" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
                <FIELD NAME="responsiblecaps" TYPE="text" NOTNULL="false" 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_req_request" COMMENT="Requests opened by users.">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
                <FIELD NAME="categoryid" 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="false" SEQUENCE="false"/>
                <FIELD NAME="subject" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="status" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="open" 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_user" UNIQUE="false" FIELDS="userid"/>
                <INDEX NAME="idx_cat" UNIQUE="false" FIELDS="categoryid"/>
                <INDEX NAME="idx_status" UNIQUE="false" FIELDS="status"/>
            </INDEXES>
        </TABLE>

        <TABLE NAME="koperedashboard_req_message" COMMENT="Request messages timeline.">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
                <FIELD NAME="requestid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="message" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
                <FIELD NAME="messageformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
                <FIELD NAME="isstaff" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
                <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
            </KEYS>
            <INDEXES>
                <INDEX NAME="idx_req" UNIQUE="false" FIELDS="requestid"/>
                <INDEX NAME="idx_staff" UNIQUE="false" FIELDS="isstaff"/>
            </INDEXES>
        </TABLE>

    </TABLES>
</XMLDB>
