<?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="autogedal_retragere" resource="default" engine="innodb" comment="Cereri retragere UE (Directiva 2023/2673)">
        <column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true"
                comment="Entity ID"/>
        <column xsi:type="smallint" name="store_id" unsigned="true" nullable="true" identity="false"
                comment="Store ID"/>
        <column xsi:type="varchar" name="firstname" nullable="false" length="128" comment="Nume"/>
        <column xsi:type="varchar" name="lastname" nullable="false" length="128" comment="Prenume"/>
        <column xsi:type="varchar" name="email" nullable="false" length="255" comment="Email"/>
        <column xsi:type="varchar" name="order_number" nullable="false" length="64" comment="Numar comanda"/>
        <column xsi:type="varchar" name="telephone" nullable="true" length="64" comment="Telefon"/>
        <column xsi:type="text" name="message" nullable="true" comment="Observatii / Motiv"/>
        <column xsi:type="varchar" name="status" nullable="false" length="32" default="new" comment="Status"/>
        <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
                comment="Created At"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="entity_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="AUTOGEDAL_RETRAGERE_STORE_ID_STORE_STORE_ID" table="autogedal_retragere" column="store_id"
                    referenceTable="store" referenceColumn="store_id" onDelete="SET NULL"/>
        <index referenceId="AUTOGEDAL_RETRAGERE_CREATED_AT" indexType="btree">
            <column name="created_at"/>
        </index>
        <index referenceId="AUTOGEDAL_RETRAGERE_STATUS" indexType="btree">
            <column name="status"/>
        </index>
    </table>
</schema>
