<?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="massproductimport_profiles" resource="default" engine="innodb" comment="MassProductImport profiles table">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
    <column xsi:type="text" name="name" nullable="false" comment="Name"/>
    <column xsi:type="datetime" name="imported_at" on_update="false" nullable="false" comment="Last Import date"/>
    <column xsi:type="longtext" name="mapping" nullable="true"/>
    <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="profile_method" padding="11" unsigned="false" nullable="false" identity="false" default="1" comment="Profile method"/>
    <column xsi:type="text" name="default_values" nullable="false" comment="Category mapping"/>
    <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="category_mapping" nullable="true" comment="Catagory mapping" disabled="true"/>
    <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="int" name="images_system_type" padding="11" unsigned="false" nullable="true" identity="false" default="0" comment="Images source system"/>
    <column xsi:type="int" name="images_use_sftp" padding="11" unsigned="false" nullable="true" identity="false" default="0" comment="USe sftp"/>
    <column xsi:type="text" name="images_ftp_host" nullable="true" comment="(s)ftp host"/>
    <column xsi:type="varchar" name="images_ftp_port" nullable="true" length="5" comment="(s)ftp port"/>
    <column xsi:type="text" name="images_ftp_login" nullable="true" comment="(s)ftp login"/>
    <column xsi:type="text" name="images_ftp_password" nullable="true" comment="(s)ftp password"/>
    <column xsi:type="int" name="images_ftp_active" padding="11" unsigned="false" nullable="true" identity="false" default="1" comment="use active ftp"/>
    <column xsi:type="text" name="images_ftp_dir" nullable="true" comment="Images ftp directory"/>
    <column xsi:type="boolean" name="product_removal" nullable="false" comment="Product removal option"/>
    <column xsi:type="boolean" name="create_configurable_onthefly" nullable="false" comment="Create Configurable Product on the fly"/>
    <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="boolean" name="create_category_onthefly" nullable="false" comment="Allow categories to be created on the fly"/>
    <column xsi:type="boolean" name="category_is_active" nullable="false" comment="Default value  for is_active"/>
    <column xsi:type="boolean" name="category_include_in_menu" nullable="false" comment="Default value for include in menu"/>
    <column xsi:type="int" name="category_parent_id" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Default parent category"/>
    <column xsi:type="text" name="dropbox_token" nullable="false" comment="Dropbox token"/>
    <column xsi:type="text" name="line_filter" nullable="false" comment="Line filter"/>
    <column xsi:type="boolean" name="has_header" nullable="false" default="true" comment="Has header"/>
    <column xsi:type="boolean" name="tree_detection" nullable="false" comment="Tree detection"/>
    <column xsi:type="boolean" name="product_target" nullable="false" comment="Action type when product removal is enabled"/>
    <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="boolean" name="post_process_indexers" nullable="false" default="true" comment="Run indexes after import"/>
    <column xsi:type="text" name="identifier_script" nullable="true" comment="Script for the identifier"/>
    <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="text" name="source_target" nullable="false" comment="List of  sources set as out of stock for product removal "/>
    <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="text" name="pos_target" nullable="false" comment="List of pos/wh (Advanced Inventory) set as out of stock for product removal "/>
    <column xsi:type="boolean" name="ftp_ssl" nullable="false" comment="Enable Ftps"/>
    <column xsi:type="boolean" name="images_ftp_ssl" nullable="false" comment="Enable Ftps"/>
    <column xsi:type="boolean" name="images_replace_if_changed" nullable="false" comment="Replace image if it has changed"/>
    <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="MASSPRODUCTIMPORT_PROFILES_ID" indexType="btree">
      <column name="id"/>
    </index>
  </table>
  <table name="catalog_product_entity" resource="default">
    <column xsi:type="int" name="created_by" padding="11" unsigned="false" nullable="true" identity="false" comment="Created by Mass Product Import profiles id"/>
    <column xsi:type="int" name="updated_by" padding="11" unsigned="false" nullable="true" identity="false" comment="Created by Mass Product Import profiles id"/>
  </table>
  <table name="massproductimport_rules" resource="default" engine="innodb" comment="MassProductImport mapping table">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
    <column xsi:type="text" name="name" nullable="false" comment="Name of the mapping"/>
    <column xsi:type="int" name="use_regexp" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Name of the mapping"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
  </table>
  <table name="massproductimport_replacement" resource="default" engine="innodb" comment="MassProductImport mapping-values table">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
    <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Mapping id "/>
    <column xsi:type="text" name="input" nullable="false" comment="Input value (regular expression)"/>
    <column xsi:type="text" name="output" nullable="false" comment="Output value (including replacements)"/>
    <column xsi:type="int" name="position" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Output value (including replacements)"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
    <constraint xsi:type="foreign" referenceId="MASSPRODUCTIMPORT_REPLACEMENT_RULE_ID" table="massproductimport_replacement" column="rule_id" referenceTable="massproductimport_rules" referenceColumn="id" onDelete="CASCADE"/>
  </table>
  <table name="eav_attribute_option_value" resource="default">
    <constraint xsi:type="unique" referenceId="EAV_ATTRIBUTE_OPTION_VALUE_OPTION_ID_STORE_ID">
      <column name="option_id"/>
      <column name="store_id"/>
    </constraint>
  </table>
  <table name="massproductimport_profiles_version_history" resource="default" engine="innodb" comment="massproductimport_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="longtext" name="content" nullable="true"/>
    <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="MASSPRODUCTIMPORT_PROFILES_VERSION_HISTORY_ID" indexType="btree">
      <column name="id"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_VERSION_HISTORY_ENTITY_ID" indexType="btree">
      <column name="entity_id"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_VERSION_HISTORY_VERSION_ID" indexType="btree">
      <column name="version_id"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_VERSION_HISTORY_USERNAME" indexType="btree">
      <column name="username"/>
    </index>
  </table>
  <table name="massproductimport_profiles_action_history" resource="default" engine="innodb" comment="massproductimport_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="longtext" name="details" nullable="true"/>
    <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="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_ACTION_ID" indexType="btree">
      <column name="action_id"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_ENTITY_ID" indexType="btree">
      <column name="entity_id"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_VERSION_ID" indexType="btree">
      <column name="version_id"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_ACTION_TYPE" indexType="btree">
      <column name="action_type"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_ORIGIN" indexType="btree">
      <column name="origin"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_USERNAME" indexType="btree">
      <column name="username"/>
    </index>
    <index referenceId="MASSPRODUCTIMPORT_PROFILES_ACTION_HISTORY_RESULT" indexType="btree">
      <column name="result"/>
    </index>
  </table>
</schema>
