<?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" extends="pagebuilder_base_form_with_background_attributes">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form_data_source</item>
        </item>
        <item name="label" xsi:type="string" translate="true">Filoblu PopUp</item>
    </argument>
    <settings>
        <namespace>pagebuilder_filoblu_popup_form</namespace>
        <deps>
            <dep>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form_data_source</dep>
        </deps>
    </settings>
    <dataSource name="pagebuilder_filoblu_popup_form_data_source">
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_PageBuilder/js/form/provider</item>
            </item>
        </argument>
        <dataProvider name="pagebuilder_filoblu_popup_form_data_source" class="Magento\PageBuilder\Model\ContentType\DataProvider">
            <settings>
                <requestFieldName/>
                <primaryFieldName/>
            </settings>
        </dataProvider>
    </dataSource>
    <fieldset name="appearance_fieldset" sortOrder="10" component="Magento_PageBuilder/js/form/element/dependent-fieldset">
        <settings>
            <label translate="true">Appearance</label>
            <additionalClasses>
                <class name="admin__fieldset-visual-select-large">true</class>
            </additionalClasses>
            <collapsible>false</collapsible>
            <opened>true</opened>
            <imports>
                <link name="hideFieldset">${$.name}.appearance:options</link>
                <link name="hideLabel">${$.name}.appearance:options</link>
            </imports>
        </settings>
        <field name="appearance" formElement="select" sortOrder="10" component="Magento_PageBuilder/js/form/element/dependent-visual-select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">default</item>
                </item>
            </argument>
            <settings>
                <additionalClasses>
                    <class name="admin__field-wide">true</class>
                    <class name="admin__field-visual-select-container">true</class>
                </additionalClasses>
                <dataType>text</dataType>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">true</rule>
                </validation>
                <elementTmpl>Magento_PageBuilder/form/element/visual-select</elementTmpl>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options class="AppearanceSourceFilobluDefault"/>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="data_min_height" sortOrder="19" formElement="input">
            <settings>
                <label translate="true">Minimum Height</label>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
                <addAfter translate="true">px</addAfter>
                <validation>
                    <rule name="validate-number" xsi:type="boolean">true</rule>
                </validation>
            </settings>
        </field>
        <field name="mobile_min_height" sortOrder="19" formElement="input">
            <settings>
                <label translate="true">Mobile Minimum Height</label>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
                <addAfter translate="true">px</addAfter>
                <validation>
                    <rule name="validate-number" xsi:type="boolean">true</rule>
                </validation>
            </settings>
        </field>
        <field name="min_height" sortOrder="20" formElement="input">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">50px</item>
                </item>
            </argument>
            <settings>
                <visible>false</visible>
            </settings>
        </field>
    </fieldset>
    <fieldset name="general" sortOrder="20">
        <settings>
            <label>General</label>
        </settings>
        <field name="popup_code" sortOrder="1" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Popup Code</label>
                <dataScope>popup_code</dataScope>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">true</rule>
                </validation>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
            </settings>
        </field>
        <field name="display_on" sortOrder="10" formElement="select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">pageload</item>
                </item>
            </argument>
            <settings>
                <dataType>text</dataType>
                <label translate="true">Display Modal on</label>
                <dataScope>display_on</dataScope>
                <switcherConfig>
                    <rules>
                        <rule name="0">
                            <value>pageload</value>
                            <actions>
                                <action name="0">
                                    <target>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form.general.cookie_duration_ms</target>
                                    <callback>show</callback>
                                </action>
                                <action name="1">
                                    <target>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form.general.delay_ms</target>
                                    <callback>show</callback>
                                </action>
                                <action name="2">
                                    <target>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form.general.display_selectors</target>
                                    <callback>hide</callback>
                                </action>
                            </actions>
                        </rule>
                        <rule name="1">
                            <value>selectors</value>
                            <actions>
                                <action name="0">
                                    <target>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form.general.display_selectors</target>
                                    <callback>show</callback>
                                </action>
                                <action name="1">
                                    <target>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form.general.cookie_duration_ms</target>
                                    <callback>hide</callback>
                                </action>
                                <action name="2">
                                    <target>pagebuilder_filoblu_popup_form.pagebuilder_filoblu_popup_form.general.delay_ms</target>
                                    <callback>hide</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">pageload</item>
                                <item name="label" xsi:type="string" translate="true">Page Load</item>
                            </option>
                            <option name="1" xsi:type="array">
                                <item name="value" xsi:type="string">selectors</item>
                                <item name="label" xsi:type="string" translate="true">Selector Click</item>
                            </option>
                        </options>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="cookie_duration_ms" sortOrder="20" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Cookie Duration</label>
                <dataScope>cookie_duration_ms</dataScope>
                <notice translate="true">Expressed in milliseconds</notice>
            </settings>
        </field>
        <field name="delay_ms" sortOrder="30" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Delay</label>
                <dataScope>delay_ms</dataScope>
                <notice translate="true">Expressed in milliseconds</notice>
            </settings>
        </field>
        <field name="display_selectors" sortOrder="40" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Selectors</label>
                <dataScope>display_selectors</dataScope>
                <notice translate="true">Comma separated classes od IDs (Ex: class1,#id1,.class2,#id2)</notice>
            </settings>
        </field>
        <field name="banner_template" sortOrder="50" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Template</label>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
                <dataScope>banner_template</dataScope>
            </settings>
        </field>
    </fieldset>
</form>
