<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package TikTok Pixel by Amasty
 */-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="amasty_pixel_tiktok" translate="label" type="text" sortOrder="200920"
                 showInDefault="1" showInWebsite="1" showInStore="1">
            <resource>Amasty_PixelTikTok::config</resource>
            <class>separator-top</class>
            <label>TikTok Pixel</label>
            <tab>amasty</tab>
            <group id="general" translate="label" type="text" sortOrder="10"
                   showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General</label>
                <field id="enabled" translate="label" type="select" sortOrder="10"
                       showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable TikTok Pixel</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="log" translate="label comment tooltip" type="select" sortOrder="20"
                       showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Log All Events Data</label>
                    <comment>If enabled you can find all frontend events data which was sent to TikTok Ads Manager in /var/log/tiktok_pixel.log file.</comment>
                    <tooltip>Be careful, enable it only for checking event data and disable after debugging, it can affect site performance.</tooltip>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
<!--                TODO: uncomment configs when the issue with brand and content will be resolved -->
<!--                <field id="enable_brand" translate="label comment" type="select" sortOrder="30"-->
<!--                       showInDefault="1" showInWebsite="1" showInStore="1">-->
<!--                    <label>Enable Brand</label>-->
<!--                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>-->
<!--                    <comment>If enabled, the attribute selected below will be passed as the brand in product parameters.</comment>-->
<!--                    <depends>-->
<!--                        <field id="enabled">1</field>-->
<!--                    </depends>-->
<!--                </field>-->
<!--                <field id="brand_attribute" translate="label" type="select" sortOrder="40"-->
<!--                       showInDefault="1" showInWebsite="1" showInStore="1">-->
<!--                    <label>Product Brand Attribute</label>-->
<!--                    <comment>The setting only displays attributes that have been configured with the option "Used in Product Listing" set to "Yes".</comment>-->
<!--                    <source_model>Amasty\PixelTikTok\Model\OptionSource\BrandAttributes</source_model>-->
<!--                    <depends>-->
<!--                        <field id="enable_brand">1</field>-->
<!--                        <field id="enabled">1</field>-->
<!--                    </depends>-->
<!--                </field>-->
                <field id="delayed_dispatch" translate="label comment tooltip" type="select" sortOrder="50"
                       showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Enable Delayed Dispatch of Server Events</label>
                    <comment>If the setting is enabled, the server events will be sent via the MessageQueue consumer "amasty_pixel_tiktok.track". It will reduce the TTFB parameter. To ensure the proper formation of queues for sending to TikTok Ads, please set them up first.</comment>
                    <tooltip><![CDATA[This functionality only works for the Events API. You can find more information about Events API <a href="https://ads.tiktok.com/help/article/events-api?lang=en" target="_blank">here</a>.]]></tooltip>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
            </group>
        </section>
    </system>
</config>
