<?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="massstockupdate_profiles" resource="default" engine="innodb" comment="MassStockUpdate profiles table">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
    <column xsi:type="varchar" name="name" nullable="false" length="150" comment="Name"/>
    <column xsi:type="datetime" name="imported_at" on_update="false" nullable="false" comment="Last Import date"/>
    <column xsi:type="text" name="mapping" nullable="true" comment="Columns mapping"/>
    <column xsi:type="text" name="cron_settings" nullable="true" comment="Cron Schedule"/>
    <column xsi:type="int" name="backup" padding="11" unsigned="false" nullable="false" identity="false" default="1" comment="Create backup before running the profile ?"/>
    <column xsi:type="int" name="sql" padding="11" unsigned="false" nullable="false" identity="false" default="1" comment="Create SQL file without updating ?"/>
    <column xsi:type="varchar" name="sql_file" nullable="true" length="150" comment="SQL file name"/>
    <column xsi:type="text" name="sql_path" nullable="true" comment="SQL file path"/>
    <column xsi:type="int" name="identifier_offset" padding="11" unsigned="false" nullable="false" identity="false" default="1" comment="Column Where To Find The Product Identifier In The CSV File"/>
    <column xsi:type="varchar" name="identifier" nullable="false" length="150" comment="Unique identifier"/>
    <column xsi:type="int" name="auto_set_total" padding="11" unsigned="false" nullable="false" identity="false" default="1" comment="Set The Global Stock Automatically" disabled="true"/>
    <column xsi:type="int" name="auto_set_instock" padding="11" unsigned="false" nullable="false" identity="false" default="1" comment="Set The Stock Status Automatically"/>
    <column xsi:type="int" name="file_system_type" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="File System Type (local,ftp,url)"/>
    <column xsi:type="int" name="use_sftp" padding="11" unsigned="false" nullable="true" identity="false" default="0" comment="Profile Use Sftp ?"/>
    <column xsi:type="text" name="ftp_host" nullable="true" comment="Profile Ftp Host"/>
    <column xsi:type="varchar" name="ftp_port" nullable="true" length="5" comment="Profile Ftp Port"/>
    <column xsi:type="text" name="ftp_password" nullable="true" comment="Profile Ftp Password"/>
    <column xsi:type="text" name="ftp_login" nullable="true" comment="Profile Ftp Login"/>
    <column xsi:type="int" name="ftp_active" padding="11" unsigned="false" nullable="true" identity="false" default="0" comment="Profile Ftp Active Mode"/>
    <column xsi:type="text" name="ftp_dir" nullable="true" comment="Profile Ftp Dir"/>
    <column xsi:type="int" name="file_type" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="File Type (csv,xml)"/>
    <column xsi:type="text" name="file_path" nullable="false" comment="File Path"/>
    <column xsi:type="varchar" name="field_delimiter" nullable="true" length="4" comment="CSV Field Delimiter"/>
    <column xsi:type="varchar" name="field_enclosure" nullable="true" length="4" comment="CSV Field enclosure"/>
    <column xsi:type="text" name="xml_xpath_to_product" nullable="false" comment="XML XPath To The Product"/>
    <column xsi:type="int" name="use_custom_rules" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Does The CSV Import Use Custom Rules"/>
    <column xsi:type="text" name="custom_rules" nullable="true" comment="CSV Custom Rules"/>
    <column xsi:type="text" name="last_import_report" nullable="true" comment="Last import report"/>
    <column xsi:type="text" name="webservice_params" nullable="true" comment="Webservice params"/>
    <column xsi:type="text" name="webservice_login" nullable="true" comment="Webservice login"/>
    <column xsi:type="text" name="webservice_password" nullable="true" comment="Webservice password"/>
    <column xsi:type="text" name="default_values" nullable="true" comment="Default Values"/>
    <column xsi:type="text" name="xml_column_mapping" nullable="true" comment="Xml columns order"/>
    <column xsi:type="boolean" name="preserve_xml_column_mapping" nullable="false" comment="Preserve the xml column order"/>
    <column xsi:type="text" name="line_filter" nullable="false" comment="Line filter"/>
    <column xsi:type="boolean" name="has_header" nullable="false" comment="Has header"/>
    <column xsi:type="boolean" name="profile_method" nullable="false" default="true" comment="Profile method"/>
    <column xsi:type="text" name="dropbox_token" nullable="false" comment="Dropbox token"/>
    <column xsi:type="boolean" name="post_process_action" nullable="false" comment="Post process action"/>
    <column xsi:type="text" name="post_process_move_folder" nullable="true" comment="Post process: move folder"/>
    <column xsi:type="text" name="identifier_script" nullable="true" comment="Script for the identifier"/>
    <column xsi:type="boolean" name="post_process_indexers" nullable="false" default="true" comment="Run indexes after import"/>
    <column xsi:type="boolean" name="is_magento_export" nullable="false" default="true" comment="Magento export file"/>
    <column xsi:type="text" name="post_process_indexers_selection" nullable="false" comment="List of  indexes to run after import"/>
    <column xsi:type="boolean" name="relative_stock_update" nullable="false" comment="Enable the relative stock update"/>
    <column xsi:type="boolean" name="enabled" nullable="false" comment="Enable the profile"/>
    <column xsi:type="boolean" name="ftp_ssl" nullable="false" comment="Enable Ftps"/>
    <column xsi:type="boolean" name="post_process_invalidate_caches" nullable="false" default="true" comment="Invalidate caches after import"/>
    <column xsi:type="boolean" name="ssl_verify" nullable="false" default="true" comment="Verify the SSL certificate of the remote server"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ID" indexType="btree">
      <column name="id"/>
    </index>
  </table>
  <table name="massstockupdate_profiles_version_history" resource="default" engine="innodb" comment="massstockupdate_profiles version history">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
    <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Entity ID (primary key)"/>
    <column xsi:type="int" name="version_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Version number"/>
    <column xsi:type="varchar" name="username" nullable="true" length="50" comment="Action author"/>
    <column xsi:type="text" name="content" nullable="true" comment="Content"/>
    <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Create date"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_VERSION_HISTORY_ID" indexType="btree">
      <column name="id"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_VERSION_HISTORY_ENTITY_ID" indexType="btree">
      <column name="entity_id"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_VERSION_HISTORY_VERSION_ID" indexType="btree">
      <column name="version_id"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_VERSION_HISTORY_USERNAME" indexType="btree">
      <column name="username"/>
    </index>
  </table>
  <table name="massstockupdate_profiles_action_history" resource="default" engine="innodb" comment="massstockupdate_profiles action history">
    <column xsi:type="int" name="action_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
    <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Entity ID (primary key)"/>
    <column xsi:type="int" name="version_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Version"/>
    <column xsi:type="varchar" name="action_type" nullable="true" length="100" comment="create / update / delete"/>
    <column xsi:type="smallint" name="origin" padding="6" unsigned="false" nullable="true" identity="false" comment="Where the action has been triggered: 1 = Backend, 2 = Cron, 3 = CLI, 4 = API"/>
    <column xsi:type="varchar" name="username" nullable="true" length="60" comment="Who triggered the action"/>
    <column xsi:type="varchar" name="result" nullable="true" length="20" comment="Success / Failed / Error / etc"/>
    <column xsi:type="text" name="message" nullable="true" comment="Message"/>
    <column xsi:type="text" name="details" nullable="true" comment="Details"/>
    <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Create date"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="action_id"/>
    </constraint>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_ACTION_ID" indexType="btree">
      <column name="action_id"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_ENTITY_ID" indexType="btree">
      <column name="entity_id"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_VERSION_ID" indexType="btree">
      <column name="version_id"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_ACTION_TYPE" indexType="btree">
      <column name="action_type"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_ORIGIN" indexType="btree">
      <column name="origin"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_USERNAME" indexType="btree">
      <column name="username"/>
    </index>
    <index referenceId="MASSSTOCKUPDATE_PROFILES_ACTION_HISTORY_RESULT" indexType="btree">
      <column name="result"/>
    </index>
  </table>
</schema>
