<?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="salesmanago_events" resource="default" engine="innodb" comment="Salesmanago Events">
        <column xsi:type="int"
                name="entity_id"
                unsigned="true"
                nullable="false"
                identity="true"
                comment="Entity ID"/>

        <column xsi:type="varchar"
                name="real_order_id"
                length="20"
                nullable="false"
                comment="Real Order ID"/>

        <column xsi:type="varchar"
                name="event_id"
                length="64"
                nullable="false"
                comment="Event ID"/>

        <column xsi:type="varchar"
                name="event_type"
                length="50"
                nullable="false"
                comment="Event Type"/>

        <column xsi:type="smallint"
                name="status"
                nullable="false"
                default="0"
                comment="Status"/>

        <column xsi:type="timestamp"
                name="created_at"
                nullable="false"
                default="CURRENT_TIMESTAMP"
                comment="Created At"/>

        <column xsi:type="timestamp"
                name="updated_at"
                nullable="false"
                default="CURRENT_TIMESTAMP"
                on_update="true"
                comment="Updated At"/>

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

        <index referenceId="SM_EVENTS_ORDER_ID">
            <column name="real_order_id"/>
        </index>
        <index referenceId="SM_EVENTS_EVENT_ID">
            <column name="event_id"/>
        </index>
    </table>
</schema>
