<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="djo_comfort_scan_items" resource="default" engine="innodb" comment="DJO Comfort Scan Table">
        <column xsi:type="int" name="id" unsigned="true" nullable="false" identity="true" comment="ID"/>

        <column xsi:type="int" name="customer_id" unsigned="true" nullable="true" identity="false" comment="Customer ID"/>
        <column xsi:type="int" name="subaccount_id" unsigned="true" nullable="true" identity="false" comment="Subaccount ID"/>

        <column xsi:type="int" name="quote_item_id" unsigned="true" nullable="true" identity="false" comment="Quote Item ID"/>
        <column xsi:type="int" name="quote_id" unsigned="true" nullable="true" identity="false" comment="Quote ID"/>

        <column xsi:type="int" name="order_id" unsigned="true" nullable="true" identity="false" comment="Order ID"/>
        <column xsi:type="int" name="order_item_id" unsigned="true" nullable="true" identity="false" comment="Order Item ID"/>

        <column xsi:type="varchar" name="oracle_account_number" nullable="true" comment="Oracle Account Number"/>
        <column xsi:type="varchar" name="patient_name" nullable="true" comment="Patient Name"/>

        <column xsi:type="varchar" name="file" nullable="true" length="255" comment="File"/>
        <column xsi:type="varchar" name="filename" nullable="true" length="255" comment="File"/>
        <column xsi:type="timestamp" name="file_added_at" on_update="false" nullable="true" comment="File Added Time"/>

        <column xsi:type="smallint" name="admin_is_processed" unsigned="false" nullable="true" identity="false" default="0" comment="Admin Processed Status"/>
        <column xsi:type="timestamp" name="admin_processed_at" on_update="false" nullable="true" comment="Admin Processed Time"/>
        <column xsi:type="varchar" name="admin_username" nullable="true" length="40" comment="Admin User"/>

        <column xsi:type="varchar" name="link_hash" nullable="true" length="255" comment="Link hash"/>

        <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Creation Time"/>
        <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP" comment="Update Time"/>

        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id"/>
        </constraint>

        <constraint xsi:type="unique" referenceId="DJO_COMFORT_SCAN_QUOTE_ITEM_ID">
            <column name="quote_item_id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="DJO_COMFORT_SCAN_ORDER_ITEM_ID">
            <column name="order_item_id"/>
        </constraint>

        <index referenceId="DJO_COMFORT_SCAN_QUOTE_ID" indexType="btree">
            <column name="quote_id"/>
        </index>
        <index referenceId="DJO_COMFORT_SCAN_ORDER_ID" indexType="btree">
            <column name="order_id"/>
        </index>
        <index referenceId="DJO_COMFORT_SCAN_ADMIN_IS_PROCESSED" indexType="btree">
            <column name="admin_is_processed"/>
        </index>
        <index referenceId="DJO_COMFORT_SCAN_FILE" indexType="btree">
            <column name="file"/>
        </index>
        <index referenceId="DJO_COMFORT_SCAN_LINK_HASH" indexType="btree">
            <column name="link_hash"/>
        </index>
    </table>
</schema>
