<?xml version="1.0"?>
<!--
/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
-->

<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
    <group id="keyword_optimization" translate="label comment" sortOrder="90" showInDefault="1" showInWebsite="0" showInStore="0">
        <label>Keyword optimization</label>
        <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Form\Optimization</frontend_model>
        <comment><![CDATA[<p>Customize how WriteText.ai optimizes your pages by setting the number of target keywords per page, choosing between automatic rewriting or flagging for review, and defining triggers based on ranking or time. You can also specify which text types to optimize. These settings apply globally unless customized for specific pages.</p>]]></comment>
        <field id="cluster_based_pipelines_count" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
            <label><![CDATA[No. of target keywords per product <br><i class="wtai-subtext">(cluster-based pipelines)</i>]]></label>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
            <validate>wtai-numeric</validate>
        </field>
        <field id="cluster_based_pipelines_count_category" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
            <label><![CDATA[No. of target keywords per category <br><i class="wtai-subtext">(cluster-based pipelines)</i>]]></label>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
            <validate>wtai-numeric</validate>
        </field>
        <group id="pipeline_keyword" translate="label" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Pipeline</label>
            <attribute type="expanded">1</attribute>
            <group id="low" translate="label" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>LOW - LOW MID</label>
                <attribute type="expanded">1</attribute>
                <field id="trigger_action" translate="label" sortOrder="20" type="select" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Trigger</label>
                    <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\TriggerActions</source_model>
                </field>
                <field id="trigger_action_n_position" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N position</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/low/trigger_action">when_page_is_ranking</field>
                    </depends>
                </field>
                <field id="trigger_action_n_days" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N days</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/low/trigger_action">after_n_days</field>
                    </depends>
                </field>
            </group>
            <group id="low_mid" translate="label" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>LOW MID - MID</label>
                <field id="trigger_action" translate="label" sortOrder="20" type="select" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Trigger</label>
                    <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\TriggerActions</source_model>
                </field>
                <field id="trigger_action_n_position" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N position</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/low_mid/trigger_action">when_page_is_ranking</field>
                    </depends>
                </field>
                <field id="trigger_action_n_days" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N days</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/low_mid/trigger_action">after_n_days</field>
                    </depends>
                </field>
            </group>
            <group id="mid" translate="label" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>MID - MID HIGH</label>
                <field id="trigger_action" translate="label" sortOrder="20" type="select" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Trigger</label>
                    <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\TriggerActions</source_model>
                </field>
                <field id="trigger_action_n_position" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N position</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/mid/trigger_action">when_page_is_ranking</field>
                    </depends>
                </field>
                <field id="trigger_action_n_days" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N days</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/mid/trigger_action">after_n_days</field>
                    </depends>
                </field>
            </group>
            <group id="mid_high" translate="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>MID HIGH - HIGH</label>
                <field id="trigger_action" translate="label" sortOrder="20" type="select" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Trigger</label>
                    <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\TriggerActions</source_model>
                </field>
                <field id="trigger_action_n_position" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N position</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/mid_high/trigger_action">when_page_is_ranking</field>
                    </depends>
                </field>
                <field id="trigger_action_n_days" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>N days</label>
                    <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\MinMax</frontend_model>
                    <validate>wtai-numeric</validate>
                    <comment>Monitoring for this trigger will only start once you transfer the text optimized with the keyword.</comment>
                    <depends>
                        <field id="writetextai_settings/keyword_optimization/pipeline_keyword/mid_high/trigger_action">after_n_days</field>
                    </depends>
                </field>
            </group>
            <field id="apply_to_all" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>Update triggers for processed items</label>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
        </group>
        <field id="automatic_text_optimization" translate="label comment" sortOrder="30" type="radios" showInDefault="1" showInWebsite="0" showInStore="0">
            <label><![CDATA[Automatic text optimization in the pipeline<br><i class="wtai-subtext">(when trigger is met in the pipeline)</i>]]></label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\AutomaticTextOptimization</source_model>
            <validate>required-entry</validate>
        </field>
        <field id="products" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Apply to product text types</label>
            <comment><![CDATA[Select the text types that you want to be automatically optimized, based on your selection above.<br><br>Only text types previously generated in WriteText.ai will be updated; otherwise it will be skipped.]]></comment>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\ProductTexts</source_model>
            <backend_model>WriteTextAI\WriteTextAI\Model\Config\Source\DefaultValues\ProductTexts</backend_model>
            <can_be_empty>1</can_be_empty>
            <validate>required-entry</validate>
        </field>
        <field id="categories" translate="label comment" type="multiselect" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Apply to category text types</label>
            <comment><![CDATA[Select the text types that you want to be automatically optimized, based on your selection above.<br><br>Only text types previously generated in WriteText.ai will be updated; otherwise it will be skipped.]]></comment>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\CategoryTexts</source_model>
            <backend_model>WriteTextAI\WriteTextAI\Model\Config\Source\DefaultValues\CategoryTexts</backend_model>
            <can_be_empty>1</can_be_empty>
            <validate>required-entry</validate>
        </field>
    </group>
</include>
    