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

    <table name="productdesigner_designs" engine="innodb"  resource="default" comment="Productdesigner Designs">
        <column xsi:type="int" name="design_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary Key of productdesigner_designs table" />
        <column xsi:type="longtext" name="design_area" nullable="true" comment = "DESIGN AREA"/>    
        <column xsi:type="varchar" name="title" nullable="false" default="0" length="255" comment = "Title"/>
        <column xsi:type="int" name="product_id" nullable="true" default="0" unsigned="true" padding="10" comment = "Product Id"/>
        <column xsi:type="int" name="associated_product_id" nullable="false" default="0" padding="10" comment = "ASSOCIATED_PRODUCT_ID"/>
        <column xsi:type="int" name="customer_id" default="0" nullable="true" padding="10" comment = "Customer id"/>
        <column xsi:type="mediumtext" name="prices" nullable="true" comment = "Prices"/>
        <column xsi:type="longtext" name="json_objects" nullable="true" comment = "Json_objects"/>
        <column xsi:type="varchar" name="scale_factor" nullable="true" length="255" comment = "Scale_factor"/>
        <column xsi:type="varchar" name="canvas_dataurl_file" nullable="true" length="255" comment = "Canvas_dataurl_file"/>
        <column xsi:type="longtext" name="relative_image_id" nullable="true" comment = "Relative_image_id"/>
        <column xsi:type="longtext" name="parent_image_id" nullable="true"  comment = "Parent_image_id"/>
        <column xsi:type="mediumtext" name="customer_comments" nullable="true" comment = "Customer_comments"/>
        <column xsi:type="varchar" name="is_display" nullable="true" length="255"  comment = "Is_display"/>
        <column xsi:type="mediumtext" name="product_info" nullable="true" comment = "Product_info"/>
        <column xsi:type="mediumtext" name="name_number_details" nullable="true" comment = "Name_number_details"/>
        <column xsi:type="longtext" name="printing_method_details" nullable="true" comment = "Printing_method_details"/>
        <column xsi:type="mediumtext" name="custom_size" nullable="true" comment = "Custom_size"/><!-- //snake_case_peer -->
        <column xsi:type="varchar" name="order" nullable="true" length="255" comment = "Order"/>
        <column xsi:type="mediumtext" name="customize_price" nullable="true" comment = "Customize_price"/>
        <column xsi:type="longtext" name="vdp_data" nullable="true" comment = "Vdp Data"/>  
        <column xsi:type="longtext" name="artworks_details" nullable="true" comment = "Artworks Details"/>  
        <column xsi:type="mediumtext" name="printing_method_data" nullable="true" comment = "Printing_method_data"/>
        <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="longtext" name="preview_dataurl_file" nullable="true" comment = "Preview_dataurl_file"/>
        <column xsi:type="varchar" name="design_type" default="product_designer" nullable="false" comment = "Design Type set like product_designer gangsheet_live gangsheet_auto "/>
        <!-- Add new column to store user's ip address and user agent -->
        <column xsi:type="text" name="user_agent_info" nullable="false" comment="User Agent and IP Address"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="design_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_PRD_ENTITY" table="productdesigner_designs" column="product_id" referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
    </table> 

    <table name="productdesigner_imageside" engine="innodb" resource="default" comment="Product Designer Image Side Table">
        <column xsi:type="int" name="imageside_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary key of productdesigner_imageside table" />
        <column xsi:type="varchar" name="imageside_title" default="" nullable="false" length="255" comment="Image side title" />
        <column xsi:type="smallint" name="status" nullable="false" default='0' padding='6' comment="Image side 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="imageside_id"/>
        </constraint>
    </table>
    
    <table name="productdesigner_printablecolor" engine="innodb"  resource="default" comment="Productdesigner Printable Colors">
        <column xsi:type="int" name="printablecolor_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary Key of productdesigner_printablecolor table" />
        <column xsi:type="varchar" name="color_name" nullable="false" default='0' length='255' comment = "Color name"/>
        <column xsi:type="varchar" name="color_code" nullable="false" default='0' length='255' comment = "Color code"/>
        <column xsi:type="int" name="status" nullable="false" default='1' padding='11' comment = "Color status"/>
        <column xsi:type="int" name="c" nullable="true" comment = "C"/>
        <column xsi:type="int" name="m" nullable="true" comment = "M"/>
        <column xsi:type="int" name="y" nullable="true" comment = "Y"/>
        <column xsi:type="int" name="k" nullable="true" comment = "K"/>
        <column xsi:type="varchar" name="pantone_color" nullable="true" length='255' comment = "Pantone Color"/>
        <column xsi:type="varchar" name="store_id" nullable="true" default='0' length='255' comment = "Color store 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="printablecolor_id"/>
        </constraint>
    </table> 

     <table name="productdesigner_fonts" engine="innodb"  resource="default" comment="Product Designer Fonts Table">
        <column xsi:type="int" name="fonts_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary key of productdesigner_fonts table" />
        <column xsi:type="varchar" name="font_label" nullable="false" length="255" default="" comment = "Font label"/>
        <column xsi:type="varchar" name="font_file" length="255" nullable="false" default=""  comment = "Font file path"/>
        <column xsi:type="int" name="position" nullable="true" unsigned="true"  padding="10" comment = "Font position"/>
        <column xsi:type="smallint" name="status" nullable="false" default="0" padding="6" comment = "Font status"/>
        <column xsi:type="varchar" name="store_id" nullable="false" default="" length="255" comment = "Font store id"/>
        <column xsi:type="varchar" name="font_image" nullable="false" default="" length="255" comment = "Font image path"/>
        <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="font_file_bold" length="255" nullable="true" comment = "Font File Bold"/>
        <column xsi:type="varchar" name="font_file_italic" length="255" nullable="true" comment = "Font File Italic"/>
        <column xsi:type="varchar" name="font_file_bold_italic" length="255" nullable="true" comment = "Font File Bold Italic"/>
        <column xsi:type="varchar" name="font_label_bold" length="255" nullable="true" comment = "Font Label Bold"/>
        <column xsi:type="varchar" name="font_label_italic" length="255" nullable="true" comment = "Font Label Italic"/>
        <column xsi:type="varchar" name="font_label_bold_italic" length="255" nullable="true" comment = "Font Label Bold Italic"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="fonts_id"/>
        </constraint>
    </table>

    <table name="productdesigner_clipart" engine="innodb"  resource="default" comment="Product Designer Image Effect">
        <column xsi:type="int" name="clipart_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Clipart Id" />
        <column xsi:type="varchar" name="clipart_title" nullable="false" length="255" default="" comment = "Clipart Title"/>
         <column xsi:type="smallint" name="is_root_category" padding="6" default="0" nullable="false" comment = "Is Root Category"/>
        <column xsi:type="varchar" name="parent_categories" nullable="false" length="255" default="" comment = "Parent Category"/>
        <column xsi:type="varchar" name="is_pattern" nullable="false" length="255" default="" comment = "Is Pattern"/>
        <column xsi:type="smallint" name="status" padding="6" default="0" nullable="false" 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" 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="clipart_id"/>
        </constraint>
    </table>

    <table name="productdesigner_clipartmedia" 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="clipart_id" nullable="false" unsigned="true" padding="10" comment = "Clipart id"/>
        <column xsi:type="varchar" name="image_path" nullable="false" length="255" default="" comment = "Image Path"/>
        <column xsi:type="varchar" name="medium_path" nullable="false" length="255" default="" comment = "Medium Path"/>
        <column xsi:type="varchar" name="resized_path" nullable="false" length="255" default="" comment = "Resized 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 = "Disabled"/>
        <column xsi:type="varchar" name="price" nullable="false" length="255" default="" comment = "Price"/>
        <column xsi:type="int" name="width" nullable="true" unsigned="true" comment = "Width of Image"/>
        <column xsi:type="int" name="height" nullable="true" unsigned="true" comment = "Height of Image"/>
        <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_CLIPART_ID" table="productdesigner_clipartmedia" column="clipart_id" referenceTable="productdesigner_clipart" referenceColumn="clipart_id" onDelete="CASCADE"/>
    </table>

    <table name="productdesigner_config" engine="innodb" resource="default" comment="Product Designer condfiguration">
        <column xsi:type="int" name="id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary key of productdesigner_config table" />
        <column xsi:type="int" name="product_id" nullable="true" default='0' padding='11' unsigned="true" comment = "PRODUCT ID"/>
        <constraint xsi:type="foreign" referenceId="PD_PRODID_ENTITY" table="productdesigner_config" column="product_id" referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
        <column xsi:type="smallint" name="enable_product_designer" nullable="false" default='0' padding='6' comment="Enable product Designer" />
        <column xsi:type="decimal" name="customized_products_price" nullable="false" scale="2" precision="6" comment="customized product price"/>
        <column xsi:type="decimal" name="added_text_price" nullable="false" scale="2" precision="6" comment="text price"/>
        <column xsi:type="decimal" name="custom_added_image_price" nullable="false" scale="2" precision="6" comment="custom image uploaded price"/>
        <column xsi:type="text" name="pre_loaded_template" nullable="false" comment="Pre loaded tempalate"/>
        <column xsi:type="text" name="default_clipart_category" nullable="false" comment="Default Clipart Category"/>
        <column xsi:type="text" name="default_artwork_category" nullable="false" comment="Default Artwork Category"/>
        <column xsi:type="text" name="allowed_output_type" nullable="false"  comment="Allowed Output Type"/>
        <column xsi:type="text" name="designer_product_type" nullable="false" comment="Product Type"/>
        <column xsi:type="text" name="output_type" nullable="false" comment="Output Type"/>
        <column xsi:type="smallint" name="dpi" nullable="false" comment="DPI" />
        <column xsi:type="text" name="default_unit" nullable="false" comment="Default Unit"/>
        <column xsi:type="mediumtext" name="more_such_product" nullable="false" comment="More such products"/>
        <column xsi:type="int" name="select_layout" nullable="true" padding="10" unsigned="true" comment="Selected Layout ID"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="id"/>
        </constraint>
   </table>

    <table name="productdesigner_producttype" resource="default" engine="innodb" comment="Product Type">
        <column xsi:type="int" name="producttype_id" padding="6" unsigned="true" identity="true" nullable="false" comment="Primary Key of productdesigner_producttype table"/>
        <column xsi:type="varchar" name="producttype_name" default="" nullable="false" length="255" comment="Product Type Name" />
        <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 xsi:type="primary" referenceId="PRIMARY">
            <column name="producttype_id"/>
        </constraint>
    </table>

    <table name="productdesigner_uploaded_image" engine="innodb"  resource="default" comment="Productdesigner Customers images">
        <column xsi:type="int" name="id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary Key of table" />
        <column xsi:type="int" name="customer_id" nullable="false" unsigned="true" default='0' padding='10' comment = "Customer Id"/>
        <column xsi:type="varchar" name="image_path" nullable="true" length='255' comment = "Image Path"/>
        <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="CD_CUST_ENTITY" table="productdesigner_uploaded_image" column="customer_id" referenceTable="customer_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
    </table> 

    <table name="productdesigner_design_images" engine="innodb"  resource="default" comment="Productdesigner Design Image">
        <column xsi:type="int" name="image_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Primary Key of productdesigner_designs table" />
        <column xsi:type="int" name="design_id" nullable="false" padding="10" unsigned="true" comment = "Design Id"/>
        <column xsi:type="int" name="product_image_id" nullable="true" default="0" padding="10" unsigned="true" comment = "Image Id of product image"/>
        <column xsi:type="varchar" name="design_image_type" nullable="false" default="" length="255" comment = "Design image type of design"/>
        <column xsi:type="varchar" name="image_path" nullable="false" default="" length="255" comment = "Path of generated image"/>
        <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="prod_image_id" length="255" nullable="true" comment = "Prod_image_id"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="image_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_DESIGN_ID_KEY" table="productdesigner_design_images" column="design_id" referenceTable="productdesigner_designs" referenceColumn="design_id" onDelete="CASCADE"/>
    </table>
   
    <table name="productdesigner_order" engine="innodb"  resource="default" comment="Product Designer Order Table">
        <column xsi:type="int" name="id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Id" />
        <column xsi:type="varchar" name="order_id" nullable="false" length="255" default="" comment = "Order id"/>
        <column xsi:type="int" name="design_id" nullable="false" unsigned="true" padding="10" comment = "Design id"/>
        <column xsi:type="smallint" name="status" nullable="false" default="0" padding="6" comment = "Status"/>
        <column xsi:type="smallint" name="flag" nullable="false" default="0" padding="6" comment = "Flag"/>

        <column xsi:type="mediumtext" name="error_message" nullable="true" comment = "Error Message"/>
        <column xsi:type="int" name="item_id" nullable="true" unsigned="true" padding="10" comment = "Item id"/>
        <column xsi:type="smallint" name="is_deleted_flag" padding="6" default="0" nullable="false" comment = "Is Deleted 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="id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="PD_ORDER_DESIGN_ID_KEY" table="productdesigner_order" column="design_id" referenceTable="productdesigner_designs" referenceColumn="design_id" onDelete="CASCADE"/>
    </table>

    <table name="productdesigner_feature" engine="innodb"  resource="default" comment="Feature tabel">
        <column xsi:type="int" name="feature_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Feature_id" />
        <column xsi:type="text" name="feature_label" nullable="false" comment = "Feature_label"/>
        <column xsi:type="text" name="feature_unique_label" nullable="false" comment = "Feature_unique_label"/>
        <column xsi:type="smallint" name="visible_admin" nullable="false" default='1' padding='6' comment = "Visible_admin"/>
        <column xsi:type="varchar" name="group" nullable="false" default='Others' length='255' comment = "Group"/>
        <column xsi:type="varchar" name="layout_industry" nullable="false" default='apparel,card,wide' length='255' comment = "Layout Industry"/>
        <column xsi:type="timestamp" name="created_at" nullable="true" 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="feature_id"/>
        </constraint>
    </table>  

    <table name="productdesigner_tab" engine="innodb"  resource="default" comment="Tab tabel">
        <column xsi:type="int" name="tab_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Tab_id" />
        <column xsi:type="text" name="tab_label" nullable="false" comment = "Tab_label"/>
        <column xsi:type="text" name="tab_router" nullable="false" comment = "Tab_router"/>
        <column xsi:type="smallint" name="status" nullable="false" padding="6" default="1" comment = "Status"/>
        <column xsi:type="mediumtext" name="tab_features" nullable="false" comment = "Tab_features"/>
        <column xsi:type="smallint" name="visible_admin" nullable="false" padding="6" default="1" comment = "Visible_admin"/>
        <column xsi:type="smallint" name="visible_frontend" nullable="false" padding="6" default="1" comment = "Visible_frontend"/>
        <column xsi:type="timestamp" name="created_at" nullable="true" 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="mediumtext" name="tab_subtab" nullable="true" comment = "Tab_subtab"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="tab_id"/>
        </constraint>
    </table>

    <table name="productdesigner_layout" engine="innodb"  resource="default" comment="Layout tabel">
        <column xsi:type="int" name="layout_id" identity="true"  nullable="false" padding="10" unsigned="true" comment="Layout_id" />
        <column xsi:type="text" name="layout_name" nullable="false" comment = "Layout_name"/>
        <column xsi:type="mediumtext" name="layout_thumbnail" nullable="false" comment = "Layout_thumbnail"/>
        <column xsi:type="mediumtext" name="layout_frontend" nullable="false" comment = "Layout_frontend"/>
        <column xsi:type="mediumtext" name="layout_frontend_additional" nullable="false" comment = "Layout_frontend_additional"/>
        <column xsi:type="mediumtext" name="layout_admin" nullable="false" comment = "Layout_admin"/>
        <column xsi:type="mediumtext" name="layout_admin_additional" nullable="false" comment = "Layout_admin_additional"/>
        <column xsi:type="mediumtext" name="layout_categories" nullable="false" comment = "Layout_categories"/>
        
        <column xsi:type="int" name="parent_id" nullable="true" padding="10" comment = "Parent_id"/>
        <column xsi:type="int" name="duplicate_id" nullable="false" padding="10" comment = "Duplicate_id"/>
        <column xsi:type="timestamp" name="created_at" nullable="true" 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="mediumtext" name="layout_tour" nullable="false" comment = "Layout_tour"/>
        <column xsi:type="varchar" name="layout_industry" nullable="false" length="255" default="apparel" comment = "Layout_industry"/>
        <constraint referenceId="PRIMARY" xsi:type="primary">
            <column name="layout_id"/>
        </constraint>
    </table> 

</schema>