<?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="shenobis_product_push_notification" resource="default" engine="innodb"
           comment="Product Push Notifications">
        <column xsi:type="int" name="notification_id" unsigned="true" nullable="false" identity="true"
                comment="Notification ID"/>
        <column xsi:type="varchar" name="event_type" nullable="false" length="64" comment="Event Type"/>
        <column xsi:type="int" name="product_id" unsigned="true" nullable="true" comment="Product ID"/>
        <column xsi:type="varchar" name="sku" nullable="false" length="64" comment="SKU"/>
        <column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
        <column xsi:type="text" name="payload" nullable="false" comment="JSON Payload"/>
        <column xsi:type="smallint" name="delivered" unsigned="true" nullable="false" default="0"
                comment="Delivered To Receiver"/>
        <column xsi:type="text" name="delivery_error" nullable="true" comment="Delivery Error"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP"
                comment="Created At"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="notification_id"/>
        </constraint>
        <index referenceId="SHENOBIS_PRODUCT_PUSH_NOTIFICATION_EVENT_TYPE" indexType="btree">
            <column name="event_type"/>
        </index>
        <index referenceId="SHENOBIS_PRODUCT_PUSH_NOTIFICATION_SKU" indexType="btree">
            <column name="sku"/>
        </index>
        <index referenceId="SHENOBIS_PRODUCT_PUSH_NOTIFICATION_CREATED_AT" indexType="btree">
            <column name="created_at"/>
        </index>
    </table>
</schema>
