<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

    <table name="productdesigner_selection_area" engine="innodb"  resource="default" comment="Productdesigner Selection Area">
        <column xsi:type="int" name="id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary Key of productdesigner_selection_area table" />

        <column xsi:type="text" name="design_area" nullable="true" comment = "DESIGN AREA"/>
        <column xsi:type="int" name="image_id" nullable="true" unsigned="true" default='0' padding='11' comment = "IMAGE ID"/>
        <column xsi:type="int" name="imageside_id" nullable="true" padding='11' comment = "IMAGESIDE ID"/>
        <column xsi:type="text" name="product_size" nullable="true"  comment = "PRODUCT SIZE"/>
        <column xsi:type="varchar" name="use_parent" nullable="false" length='255' comment = "use_parent"/>
        <column xsi:type="varchar" name="custom_output" nullable="true" length='255' comment = "Custom Output"/>
        <column xsi:type="int" name="product_id" nullable="true" default='0' padding='11' unsigned="true" comment = "PRODUCT ID"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="id"/>
        </constraint>

        <constraint xsi:type="foreign" referenceId="IM_IMAGEID_GALLERY" table="productdesigner_selection_area" column="image_id" referenceTable="catalog_product_entity_media_gallery" referenceColumn="value_id" onDelete="CASCADE"/>

        <constraint xsi:type="foreign" referenceId="PD_PRODID_ENTITY" table="productdesigner_selection_area" column="product_id" referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
    </table>
   
    <table name="productdesigner_artworks_category" engine="innodb"  resource="default" comment="Product Designer Artwork Category">
        <column xsi:type="int" name="artwork_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Artwork Id" />
        <column xsi:type="varchar" name="name" nullable="false" length="255" default="" comment = "Name"/>
        <column xsi:type="smallint" name="is_root_category" nullable="false" default="0" padding="6" comment = "Is Root Category"/>
        <column xsi:type="varchar" name="parent_categories" nullable="false" length="255" default="" comment = "Parent Categories"/>
        <column xsi:type="varchar" name="parent_categories_name" nullable="false" length="255" default="" comment = "Parent Categories Name"/>
        <column xsi:type="smallint" name="status" padding="6" default="0" nullable="false" comment = "Status Flag"/>

         <column xsi:type="varchar" name="store_id" nullable="false" default="" length="255" comment = "Design id"/>
        <column xsi:type="int" name="level" nullable="false" unsigned="true" padding="10" comment = "Level"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="artwork_id"/>
        </constraint>
    </table>
    <table name="productdesigner_artworks" engine="innodb"  resource="default" comment="Product Designer Artwork Category">
        <column xsi:type="int" name="artwork_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Artwork Id" />
        <column xsi:type="varchar" name="artwork_cat_id" nullable="false" length="255" default="" comment = "Artwork Category Id"/>
     
        <column xsi:type="varchar" name="name" nullable="false" length="255" default="" comment = "Name"/>
        <column xsi:type="varchar" name="artwork_path" nullable="false" length="255" default="" comment = "Artwork Path"/>
        <column xsi:type="decimal" name="price" nullable="false" scale="6" precision="20" default="0" comment = "Price"/>
        <column xsi:type="smallint" name="status" padding="6" default="0" nullable="false" comment = "Status Flag"/>
        <column xsi:type="int" name="user" nullable="false" unsigned="true" padding="10" comment = "User id"/>
        <column xsi:type="varchar" name="store_id" nullable="false" comment = "Store id"/>
        <column xsi:type="varchar" name="method" nullable="false" comment = "Method"/>
        <column xsi:type="longtext" name="json_objects" nullable="true"  comment = "Json Object"/>
        <column xsi:type="smallint" name="is_imported" padding="6" default="0" nullable="false" comment = "Is Imported"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <column xsi:type="varchar" name="shape" nullable="false" comment = "Shape"/>
        <column xsi:type="varchar" name="artwork_thumbnail" nullable="true" comment = "Artwork Thumbnail"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="artwork_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_USER_ID_KEY" table="productdesigner_artworks_category" column="user" referenceTable="admin_user" referenceColumn="user_id" onDelete="CASCADE"/>
    </table>
     <table name="productdesigner_imageeffects" engine="innodb"  resource="default" comment="Product Designer Image Effect">
        <column xsi:type="int" name="effect_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Image Effect Id" />
        <column xsi:type="varchar" name="effect_name" nullable="false" length="255" default="" comment = "Effect Name"/>
        <column xsi:type="varchar" name="value" nullable="true" length="255" default="" comment = "Value"/>
        <column xsi:type="varchar" name="effect_image" nullable="true" length="255" default="" comment = "Effect Image"/>
        <column xsi:type="varchar" name="label" nullable="true" length="255" default="" comment = "Label"/>
        <column xsi:type="smallint" name="status" padding="6" default="0" nullable="false" comment = "Status Flag"/>
        <column xsi:type="smallint" name="is_filter" padding="6" default="0" nullable="false" comment = "Is Filter"/>
        <column xsi:type="varchar" name="default_value" nullable="true" length="255" default="" comment = "Default Value"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="effect_id"/>
        </constraint>
    </table>
    <table name="productdesigner_designtemplatesimport" engine="innodb"  resource="default" comment="Product Designer Import Template">
        <column xsi:type="int" name="import_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Import Id" />
        <column xsi:type="int" name="product_id" nullable="false" unsigned="true" padding="10" comment = "Product id"/>
        <column xsi:type="varchar" name="product_name" nullable="false" length="255" default="" comment = "Product Name"/>
        <column xsi:type="varchar" name="template_name" nullable="false" length="255" default="" comment = "Template Name"/>
        <column xsi:type="int" name="artwork_id" nullable="false" unsigned="true" padding="10" comment = "Artwork id"/>
        <column xsi:type="varchar" name="artwork_name" nullable="false" length="255" default="" comment = "Artwork Name"/>
        <column xsi:type="varchar" name="side_name" nullable="false" length="255" default="" comment = "Side Name"/>
        <column xsi:type="varchar" name="price" nullable="false" length="255" default="" comment = "Price"/>
        <column xsi:type="smallint" name="is_visible" padding="6" default="0" nullable="false" comment = "Is Visible"/>
        <column xsi:type="smallint" name="is_imported" padding="6" default="0" nullable="false" comment = "Is Is Imported"/>
        <column xsi:type="varchar" name="custom_option_title" nullable="true" length="255" default="" comment = "Custom Option Title for resize pre-selection"/>
        <column xsi:type="varchar" name="default_value" nullable="false" length="255" default="" comment = "Default Value"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="import_id"/>
        </constraint>
    </table>
    
    <table name="productdesigner_masking" engine="innodb"  resource="default" comment="Product Designer Image Effect">
        <column xsi:type="int" name="masking_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Masking Id" />
        <column xsi:type="varchar" name="masking_label" nullable="false" length="255" default="" comment = "Masking Level"/>
        <column xsi:type="varchar" name="masking_image" nullable="false" length="255" default="" comment = "Masking Image"/>
          <column xsi:type="varchar" name="svg_mask_image" nullable="false" length="255" default="" comment = "SVG Masking Image"/>
        <column xsi:type="int" name="status" nullable="false" unsigned="true" padding="10" comment = "Status"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="masking_id"/>
        </constraint>
    </table>
    <table name="productdesigner_designtemplates" engine="innodb"  resource="default" comment="Product Designer Image Effect">
        <column xsi:type="int" name="designtemplates_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Designtemplate Id" />
        <column xsi:type="varchar" name="template_title" nullable="false" length="255" default="" comment = "Template Title"/>
        <column xsi:type="int" name="product_id" nullable="false" unsigned="true" padding="10" comment = "Product Id"/>
        <column xsi:type="varchar" name="price" nullable="false" length="255" default="" comment = "Price"/>
        <column xsi:type="varchar" name="thumbnail" nullable="true" length="255" default="" comment = "Thumbnail"/>
        <column xsi:type="varchar" name="store_id" nullable="false" default="" length="255" comment = "Store id"/>
        <column xsi:type="varchar" name="method" nullable="false" default="gotodesign" length="255" comment = "Method"/>
        <column xsi:type="longtext" name="json_objects" nullable="true" comment = "Json Object"/>
        <column xsi:type="smallint" name="status" padding="6" default="0" nullable="false" comment = "Status Flag"/>
        <column xsi:type="smallint" name="visible" padding="6" default="0" nullable="false" comment = "Visible"/>
        <column xsi:type="smallint" name="publish_status" padding="6" default="0" nullable="false" comment = "Publish Status" disabled="true"/>
        <column xsi:type="smallint" name="is_copied" padding="6" default="0" nullable="false" comment = "Is Copied"/>
        <column xsi:type="varchar" name="group_id" nullable="true" length="255" comment = "Group Id"/>
        <column xsi:type="mediumtext" name="data_url" nullable="true" comment = "Data Url"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <column xsi:type="int" name="associated_product_id" nullable="true" unsigned="true" padding="10" comment = "Associated Product Id"/>
        <column xsi:type="varchar" name="artwork" nullable="false" length="255" default="" comment = "Artwork"/>
        <column xsi:type="varchar" name="artwork_path" nullable="false" length="255" default="" comment = "Artwork Path"/>
        <column xsi:type="varchar" name="artwork_category" nullable="false" length="255" default="" comment = "Artwork Category"/>
        <column xsi:type="varchar" name="is_imported" nullable="false" length="255" default="" comment = "Is Imported"/>
        <column xsi:type="longtext" name="preview_dataurl_file" nullable="false" comment = "Preview Dataurl File"/>
        <column xsi:type="mediumtext" name="custom_size" nullable="true" comment = "Customize Size"/>
        <column xsi:type="longtext" name="vdp_data" nullable="true" comment = "VDP Data"/>
        <column xsi:type="longtext" name="customize_price" nullable="true" comment = "Decoration Price"/>
        <column xsi:type="int" name="userid" nullable="true" unsigned="true" padding="10" comment = "User Id" disabled="true"/>
        <column xsi:type="varchar" name="reason_for_disable" nullable="true" length="255" default="" comment = "Reason for Disable"/>
        <column xsi:type="smallint" name="disabled_by" padding="6" default="0" nullable="true" comment = "Disabled By"/>
        <column xsi:type="longtext" name="artworks_details" nullable="true" comment = "Artworks Details"/>
        <column xsi:type="mediumtext" name="import_artwork_side" nullable="true" comment = "Import Artwork id side wise"/>
        <column xsi:type="varchar" name="custom_option_title" nullable="true" length="255" default="" comment = "Custom Option Title for resize pre-selection"/>

        <constraint referenceId="PRIMARY" xsi:type="primary">
        <column name="designtemplates_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_PRODUCTDESIGNER_DESIGNTEMPLATE" table="productdesigner_designtemplates" column="product_id" referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>        
    </table>
    <table name="productdesigner_background_image_category" engine="innodb"  resource="default" comment="Product Designer Image Effect">
        <column xsi:type="int" name="category_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Category Id" />
        <column xsi:type="varchar" name="image_title" nullable="false" length="255" default="" comment = "Image Title"/>
        <column xsi:type="smallint" name="is_root_category" padding="6" default="0" nullable="false" comment = "Is Root Category Falg"/>
        <column xsi:type="varchar" name="parent_categories" nullable="false" length="255" default="" comment = "Parent Category"/>
        <column xsi:type="smallint" name="status" padding="6" default="0" nullable="false" comment = "Status Flag"/>
        <column xsi:type="varchar" name="store_id" nullable="false" default="" length="255" comment = "Store id"/>
        <column xsi:type="int" name="level" nullable="false" unsigned="true" padding="10" comment = "Level"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
        <column name="category_id"/>
        </constraint>
    </table>
    <table name="productdesigner_background_images" engine="innodb"  resource="default" comment="Product Designer Image Effect">
        <column xsi:type="int" name="image_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Image Id" />
        <column xsi:type="int" name="category_id" nullable="false" unsigned="true" padding="10" comment = "Category id"/>
        <column xsi:type="varchar" name="image_path" nullable="false" length="255" default="" comment = "Image Path"/>
        <column xsi:type="varchar" name="label" nullable="false" length="255" default="" comment = "Label"/>
        <column xsi:type="varchar" name="tags" nullable="false" length="255" default="" comment = "tags"/>
        <column xsi:type="int" name="position" nullable="true" unsigned="true" padding="10" comment = "position"/>
        <column xsi:type="smallint" name="disabled" padding="6" default="0" nullable="false" comment = "Is Root Disabled Falg"/>
        <column xsi:type="varchar" name="price" nullable="false" length="255" default="" comment = "price"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="image_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_CATEGORY_ID" table="productdesigner_background_images" column="category_id" referenceTable="productdesigner_background_image_category" referenceColumn="category_id" onDelete="CASCADE"/>
    </table>

    <table name="productdesigner_shapes" engine="innodb"  resource="default" comment="Product Designer Shapes">
        <column xsi:type="int" name="shape_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Shape Id" />
        <column xsi:type="text" name="shape_name" nullable="false" comment = "Shape Title"/>
        <column xsi:type="text" name="shape_main_image" nullable="false" comment = "Shape Main Image"/>
        <column xsi:type="text" name="shape_masking_image" nullable="false" comment = "Shape Masking Image"/>    
        <column xsi:type="smallint" name="status" padding="6" default="1" nullable="false" comment = "Status Flag"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="shape_id"/>
        </constraint>
    </table>

    <table name="productdesigner_projectid" engine="innodb"  resource="default" comment="Product Designer Project Id">
        <column xsi:type="int" name="id" identity="true"  nullable="false" padding="10" unsigned="true" comment=" Id" />
        <column xsi:type="text" name="project_id" nullable="false" comment = "Project Id"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <column xsi:type="int" name="customer_id" default="0" nullable="true" padding="10" comment = "Customer id"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="id"/>
        </constraint>
    </table>
    <table name="productdesigner_projectid_uploaded_image" engine="innodb" resource="default" comment="Product Designer Project Id">
        <column xsi:type="int" name="id" identity="true" nullable="false" padding="10" unsigned="true" comment="Id"/>
        <column xsi:type="text" name="project_id" nullable="false" comment="Project Id"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="created_at" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at" on_update="true"/>
        <column xsi:type="varchar" name="image_path" default="" nullable="false" length="255" comment="Image Path"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="id"/>
        </constraint>
    </table>

    <table name="productdesigner_frame_category" engine="innodb" resource="default" comment="Product Designer Frame/Shape Category">
        <column xsi:type="int" name="frame_category_id" identity="true" nullable="false" padding="10" unsigned="true" comment="Frame Category Id"/>
        <column xsi:type="varchar" name="title" nullable="false" length="255" default="" comment="Title"/>
        <column xsi:type="smallint" name="is_root_category" nullable="false" default="0" padding="6" comment="Is Root Category"/>
        <column xsi:type="int" name="parent_category_id" nullable="true" unsigned="true" padding="10" comment="Parent Category Id"/>
        <column xsi:type="smallint" name="is_shape" nullable="false" default="0" padding="6" comment="Is Shape (0=Frame, 1=Shape)"/>
        <column xsi:type="smallint" name="status" nullable="false" default="1" padding="6" comment="Status"/>
        <column xsi:type="varchar" name="store_id" nullable="false" default="" length="255" comment="Store Id"/>
        <column xsi:type="int" name="level" nullable="false" default="0" unsigned="true" padding="10" comment="Level"/>
        <column xsi:type="smallint" name="ai" nullable="false" default="0" padding="6" comment="AI Enabled"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated At" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="frame_category_id"/>
        </constraint>
    </table>

    <table name="productdesigner_frame" engine="innodb" resource="default" comment="Product Designer Frame/Shape">
        <column xsi:type="int" name="frame_id" identity="true" nullable="false" padding="10" unsigned="true" comment="Frame Id"/>
        <column xsi:type="int" name="frame_category_id" nullable="false" unsigned="true" padding="10" comment="Frame Category Id"/>
        <column xsi:type="varchar" name="main_image" nullable="false" length="255" default="" comment="Main Image (JPG/PNG)"/>
        <column xsi:type="varchar" name="masking_image" nullable="true" length="255" default="" comment="Masking Image (SVG)"/>
        <column xsi:type="varchar" name="label" nullable="false" length="255" default="" comment="Label"/>
        <column xsi:type="varchar" name="tags" nullable="true" length="255" default="" comment="Tags"/>
        <column xsi:type="int" name="position" nullable="true" unsigned="true" padding="10" comment="Position"/>
        <column xsi:type="smallint" name="status" nullable="false" default="1" padding="6" comment="Status"/>
        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At" on_update="false"/>
        <column xsi:type="timestamp" name="updated_at" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated At" on_update="true"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="frame_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_FRAME_CATEGORY_ID_FK" table="productdesigner_frame" column="frame_category_id" referenceTable="productdesigner_frame_category" referenceColumn="frame_category_id" onDelete="CASCADE"/>
    </table>

    <table name="productdesigner_config" resource="default" comment="Product Designer configuration">
        <column xsi:type="text" name="default_frame_category" nullable="true" comment="Default Frame Category"/>
        <column xsi:type="text" name="default_shape_category" nullable="true" comment="Default Shape Category"/>
    </table>
</schema>