<?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="mapping" translate="label comment" sortOrder="70" showInDefault="1" showInWebsite="0" showInStore="0">
        <label>Map product text fields</label>
        <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Form\Fieldset</frontend_model>
        <comment><![CDATA[<p><b>Select the fields in Magento where WriteText.ai will save your text.</b><br/>By default, the standard Magento fields are selected, but you can map them to other fields if needed.</p>
        <p><b>Open Graph text</b><br>Open Graph text is what appears in the preview when your product page is shared on social media platforms like Facebook, X, or LinkedIn. Since Magento does not have a native Open Graph field, WriteText.ai uses the <b>Short Description</b> by default.</p>
        <p>If you are using an SEO module, the module may pull Open Graph data from other fields such as the <b>Meta Description</b>, <b>Description</b>, or <b>Short Description</b>, depending on its settings. In that case, WriteText.ai will follow the SEO module’s configuration. </p>
        <p>If your SEO module uses a different field, set <b>Custom Open Graph text field</b> to “Yes.” This will enable a dropdown where you can select the custom field being used for Open Graph text.</p>]]></comment>
        <field id="page_title" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Meta title</label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\ProductAttributes\Text</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\Mapping</frontend_model>
            <validate>required-entry</validate>
        </field>
        <field id="page_description" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Meta description</label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\ProductAttributes\Text</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\Mapping</frontend_model>
            <validate>required-entry</validate>
        </field>
        <field id="product_description" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Description</label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\ProductAttributes\Text</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\Mapping</frontend_model>
            <validate>required-entry</validate>
        </field>
        <field id="short_product_description" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Short description</label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\ProductAttributes\Text</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\Mapping</frontend_model>
            <validate>required-entry</validate>
        </field>
        <field id="custom_open_graph" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Custom Open Graph text field</label>
            <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\CustomOpenGraphMapping</frontend_model>
        </field>
        <field id="open_graph" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Open Graph text</label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\ProductAttributes\Text</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\Mapping</frontend_model>
            <validate>required-entry</validate>
            <depends>
                <field id="writetextai_settings/mapping/custom_open_graph">1</field>
            </depends>
        </field>
    </group>
    <group id="category_mapping" translate="label comment" sortOrder="88" showInDefault="1" showInWebsite="0" showInStore="0">
        <label>Map category text fields</label>
        <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Form\Fieldset</frontend_model>
        <comment><![CDATA[<p>Select the corresponding category fields in Magento where WriteText.ai will save the text to. The default fields are selected, but if you use other fields then you can map them here.</p>]]></comment>
        <field id="category_description" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Category Description</label>
            <source_model>WriteTextAI\WriteTextAI\Model\Config\Source\CategoryAttributes\Text</source_model>
            <frontend_model>WriteTextAI\WriteTextAI\Block\Adminhtml\System\Config\Field\Category\Mapping</frontend_model>
            <validate>required-entry</validate>
        </field>
    </group>
</include>
    