<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="refilo" sortOrder="1">
        <settings>
            <label>Refilo</label>
        </settings>
        <field name="display_on" formElement="select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">none</item>
                    <item name="source" xsi:type="string">page</item>
                </item>
            </argument>
            <settings>
                <dataType>text</dataType>
                <label translate="true">Display on</label>
                <dataScope>display_on</dataScope>
                <switcherConfig>
                    <rules>
                        <rule name="0">
                            <value>none</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.categories_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.products_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.cms_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.service_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="4">
                                    <target>cms_block_form.cms_block_form.refilo.selection_type</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="5">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_container</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="6">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_order</target>
                                    <callback>hide</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="1">
                            <value>categories</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.categories_selection</target>
                                    <callback>show</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.products_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.cms_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.service_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="4">
                                    <target>cms_block_form.cms_block_form.refilo.selection_type</target>
                                    <callback>show</callback>
                                </action>
                                <action name="5">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_container</target>
                                    <callback>show</callback>
                                </action>
                                <action name="6">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_order</target>
                                    <callback>show</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="2">
                            <value>products</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.categories_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.products_selection</target>
                                    <callback>show</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.cms_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.service_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="4">
                                    <target>cms_block_form.cms_block_form.refilo.selection_type</target>
                                    <callback>show</callback>
                                </action>
                                <action name="5">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_container</target>
                                    <callback>show</callback>
                                </action>
                                <action name="6">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_order</target>
                                    <callback>show</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="3">
                            <value>cms_pages</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.categories_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.products_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.cms_pages_selection</target>
                                    <callback>show</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.service_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="4">
                                    <target>cms_block_form.cms_block_form.refilo.selection_type</target>
                                    <callback>show</callback>
                                </action>
                                <action name="5">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_container</target>
                                    <callback>show</callback>
                                </action>
                                <action name="6">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_order</target>
                                    <callback>show</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="4">
                            <value>service_pages</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.categories_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.products_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.cms_pages_selection</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.service_pages_selection</target>
                                    <callback>show</callback>
                                </action>
                                <action name="4">
                                    <target>cms_block_form.cms_block_form.refilo.selection_type</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="5">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_container</target>
                                    <callback>show</callback>
                                </action>
                                <action name="6">
                                    <target>cms_block_form.cms_block_form.refilo.refilo_layout_order</target>
                                    <callback>show</callback>
                                </action>
                                <action name="7">
                                    <target>cms_block_form.cms_block_form.refilo.selection_type</target>
                                    <callback>setDifferedFromDefault</callback>
                                </action>
                            </actions>
                        </rule>
                    </rules>
                    <enabled>true</enabled>
                </switcherConfig>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options>
                            <option name="1" xsi:type="array">
                                <item name="value" xsi:type="string">none</item>
                                <item name="label" xsi:type="string">None</item>
                            </option>
                            <option name="2" xsi:type="array">
                                <item name="value" xsi:type="string">categories</item>
                                <item name="label" xsi:type="string">Categories</item>
                            </option>
                            <option name="3" xsi:type="array">
                                <item name="value" xsi:type="string">products</item>
                                <item name="label" xsi:type="string">Products</item>
                            </option>
                            <option name="4" xsi:type="array">
                                <item name="value" xsi:type="string">cms_pages</item>
                                <item name="label" xsi:type="string">CMS Pages</item>
                            </option>
                            <option name="5" xsi:type="array">
                                <item name="value" xsi:type="string">service_pages</item>
                                <item name="label" xsi:type="string">Service Pages</item>
                            </option>
                        </options>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="refilo_identifier" formElement="input">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="source" xsi:type="string">block</item>
                </item>
            </argument>
            <settings>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">false</rule>
                    <rule name="no-marginal-whitespace" xsi:type="boolean">true</rule>
                </validation>
                <dataType>text</dataType>
                <label translate="true">Refilo Identifier</label>
                <dataScope>refilo_identifier</dataScope>
            </settings>
        </field>
        <field name="selection_type" formElement="select" component="FiloBlu_Refilo/js/form/element/block-display-on">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">all</item>
                    <item name="source" xsi:type="string">page</item>
                </item>
            </argument>
            <settings>
                <dataType>text</dataType>
                <label translate="true">Selection Type</label>
                <dataScope>selection_type</dataScope>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options>
                            <option name="1" xsi:type="array">
                                <item name="value" xsi:type="string">all</item>
                                <item name="label" xsi:type="string">All</item>
                            </option>
                            <option name="2" xsi:type="array">
                                <item name="value" xsi:type="string">specific</item>
                                <item name="label" xsi:type="string">Specific</item>
                            </option>
                        </options>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="categories_selection" component="Magento_Catalog/js/components/new-category" sortOrder="30" formElement="select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filterOptions" xsi:type="boolean">true</item>
                    <item name="multiple" xsi:type="boolean">true</item>
                    <item name="showCheckbox" xsi:type="boolean">false</item>
                    <item name="disableLabel" xsi:type="boolean">true</item>
                    <item name="levelsVisibility" xsi:type="number">1</item>
                </item>
            </argument>
            <settings>
                <elementTmpl>ui/grid/filters/elements/ui-select</elementTmpl>
                <label translate="true">Categories</label>
                <dataScope>categories_selection</dataScope>
                <componentType>field</componentType>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options class="Magento\Catalog\Ui\Component\Product\Form\Categories\Options"/>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="products_selection" sortOrder="40" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Product SKUs</label>
                <dataScope>products_selection</dataScope>
                <notice translate="true">Comma separated product SKUs.</notice>
                <elementTmpl>Magento_PageBuilder/form/element/input-no-maxlength</elementTmpl>
            </settings>
        </field>
        <field name="cms_pages_selection" formElement="select" sortOrder="50" component="Magento_PageBuilder/js/form/element/page-ui-select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filterOptions" xsi:type="boolean">true</item>
                    <item name="multiple" xsi:type="boolean">true</item>
                    <item name="showCheckbox" xsi:type="boolean">false</item>
                    <item name="disableLabel" xsi:type="boolean">true</item>
                    <item name="levelsVisibility" xsi:type="number">1</item>
                </item>
            </argument>
            <settings>
                <elementTmpl>ui/grid/filters/elements/ui-select</elementTmpl>
                <label translate="true">CMS Page</label>
                <dataScope>cms_pages_selection</dataScope>
                <componentType>field</componentType>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options class="Magento\PageBuilder\Ui\Component\UrlInput\Page\Options"/>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="service_pages_selection" sortOrder="60" formElement="select">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Service Page</label>
                <dataScope>service_pages_selection</dataScope>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options>
                            <option name="0" xsi:type="array">
                                <item name="value" xsi:type="string">storelocator</item>
                                <item name="label" xsi:type="string" translate="true">Storelocator</item>
                            </option>
                            <option name="1" xsi:type="array">
                                <item name="value" xsi:type="string">cart</item>
                                <item name="label" xsi:type="string" translate="true">Cart</item>
                            </option>
                            <option name="2" xsi:type="array">
                                <item name="value" xsi:type="string">checkout</item>
                                <item name="label" xsi:type="string" translate="true">Checkout</item>
                            </option>
                            <option name="3" xsi:type="array">
                                <item name="value" xsi:type="string">wishlist</item>
                                <item name="label" xsi:type="string" translate="true">Wishlist</item>
                            </option>
                            <option name="4" xsi:type="array">
                                <item name="value" xsi:type="string">login</item>
                                <item name="label" xsi:type="string" translate="true">Log In</item>
                            </option>
                            <option name="5" xsi:type="array">
                                <item name="value" xsi:type="string">register</item>
                                <item name="label" xsi:type="string" translate="true">Register</item>
                            </option>
                            <option name="6" xsi:type="array">
                                <item name="value" xsi:type="string">reward_points</item>
                                <item name="label" xsi:type="string" translate="true">Reward Points</item>
                            </option>
                            <option name="7" xsi:type="array">
                                <item name="value" xsi:type="string">guest_order</item>
                                <item name="label" xsi:type="string" translate="true">Guest Order</item>
                            </option>
                        </options>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="refilo_layout_container" sortOrder="70" formElement="select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">top</item>
                </item>
            </argument>
            <settings>
                <dataType>text</dataType>
                <label translate="true">Container</label>
                <dataScope>refilo_layout_container</dataScope>
                <switcherConfig>
                    <rules>
                        <rule name="0">
                            <value>top</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_page</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_position</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.listing_columns_spacing</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.listing_row_spacing</target>
                                    <callback>hide</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="1">
                            <value>middle</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_page</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_position</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.listing_columns_spacing</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.listing_row_spacing</target>
                                    <callback>hide</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="2">
                            <value>bottom</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_page</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_position</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.listing_columns_spacing</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.listing_row_spacing</target>
                                    <callback>hide</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="3">
                            <value>listing</value>
                            <actions>
                                <action name="0">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_page</target>
                                    <callback>show</callback>
                                </action>
                                <action name="1">
                                    <target>cms_block_form.cms_block_form.refilo.listing_display_position</target>
                                    <callback>show</callback>
                                </action>
                                <action name="2">
                                    <target>cms_block_form.cms_block_form.refilo.listing_columns_spacing</target>
                                    <callback>show</callback>
                                </action>
                                <action name="3">
                                    <target>cms_block_form.cms_block_form.refilo.listing_row_spacing</target>
                                    <callback>show</callback>
                                </action>
                            </actions>
                        </rule>
                    </rules>
                    <enabled>true</enabled>
                </switcherConfig>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options>
                            <option name="0" xsi:type="array">
                                <item name="value" xsi:type="string">top</item>
                                <item name="label" xsi:type="string" translate="true">Top</item>
                            </option>
                            <option name="1" xsi:type="array">
                                <item name="value" xsi:type="string">middle</item>
                                <item name="label" xsi:type="string" translate="true">Middle</item>
                            </option>
                            <option name="2" xsi:type="array">
                                <item name="value" xsi:type="string">bottom</item>
                                <item name="label" xsi:type="string" translate="true">Bottom</item>
                            </option>
                            <option name="3" xsi:type="array">
                                <item name="value" xsi:type="string">listing</item>
                                <item name="label" xsi:type="string" translate="true">Listing</item>
                            </option>
                        </options>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="listing_display_page" sortOrder="80" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Listing display page</label>
                <dataScope>listing_display_page</dataScope>
                <notice translate="true">Listing page number where block is shown</notice>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
            </settings>
        </field>
        <field name="listing_display_position" sortOrder="90" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Listing display position</label>
                <dataScope>listing_display_position</dataScope>
                <notice translate="true">Position number of the block among products</notice>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
            </settings>
        </field>
        <field name="listing_columns_spacing" sortOrder="100" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Listing column spacing</label>
                <dataScope>listing_columns_spacing</dataScope>
                <notice translate="true">Block column number</notice>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
            </settings>
        </field>
        <field name="listing_row_spacing" sortOrder="105" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Listing row spacing</label>
                <dataScope>listing_row_spacing</dataScope>
                <notice translate="true">Block row number</notice>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
            </settings>
        </field>
        <field name="refilo_layout_order" sortOrder="110" formElement="input">
            <settings>
                <dataType>number</dataType>
                <label translate="true">Sort Order</label>
                <dataScope>refilo_layout_order</dataScope>
                <visible>true</visible>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
            </settings>
        </field>
        <field name="customer_group" sortOrder="120" formElement="multiselect">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Customer Group</label>
                <dataScope>customer_group</dataScope>
                <visible>true</visible>
            </settings>
            <formElements>
                <multiselect>
                    <settings>
                        <options class="FiloBlu\Refilo\Model\ResourceModel\Group\Collection" />
                    </settings>
                </multiselect>
            </formElements>
        </field>
    </fieldset>
    <fieldset name="general" sortOrder="10">
        <settings>
            <label>General</label>
        </settings>
    </fieldset>
</form>
