<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="mst_reports" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Advanced Reports</label>
            <tab>mirasvit</tab>
            <resource>Mirasvit_Reports::config</resource>
            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1">
                <label>General settings</label>

                <field id="order_status" translate="label comment" type="multiselect" sortOrder="10" showInDefault="1">
                    <label>Order statuses as default filter</label>
                    <source_model>Mirasvit\Reports\Model\Config\Source\OrderStatusSource</source_model>
                    <comment>Used to filter sales reports by order statuses</comment>
                </field>

                <field id="group_by_dimensions" translate="label comment" type="select" sortOrder="20" showInDefault="1">
                    <label>Group report data by dimensions</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>If enabled, the extension will group data in multidemensional reports to avoid displaying duplicated data for dimension columns</comment>
                </field>

                <field id="format_csv" translate="label comment" type="select" sortOrder="30" showInDefault="1">
                    <label>Format data in CSV files</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <config_path>mst_report/export_csv/format_data</config_path>
                    <comment>If disabled, the extension will put unformatted (raw) data for numeric columns in CSV files</comment>
                </field>

                <field id="maps_api_key" translate="label comment" type="text" sortOrder="40" showInDefault="1">
                    <label>Google Maps API key</label>
                    <config_path>mst_report/general/maps_api_key</config_path>
                    <comment>Optional. The Geo chart works without a key; set one only to silence the Google Maps warning in the browser console</comment>
                </field>
            </group>
            <group id="advanced" translate="label" type="text" sortOrder="10" showInDefault="1">
                <label>Advanced settings</label>

                <field id="logging" translate="label comment" type="select" sortOrder="10" showInDefault="1">
                    <label>Use CTEs instead of temporary tables</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <config_path>mst_report/advanced/use_cte</config_path>
                    <comment><![CDATA[Some reports use a complex data retrieval mechanism that relies on temporary tables.<br/>In cases involving large datasets, this can lead to table locking issues.<br/>Enabling this setting replaces temporary tables with CTEs (Common Table Expressions), which can prevent locking issues.<br/><div class="messages"><div class="message">Use this option only if your database server is running MySQL 8.0 or higher, or MariaDB 10.2 or higher, as earlier versions do not support CTEs.</div></div>]]></comment>
                </field>
            </group>
            <group id="debug" translate="label" type="text" sortOrder="10" showInDefault="1">
                <label>Debugging</label>

                <field id="logging" translate="label comment" type="select" sortOrder="10" showInDefault="1">
                    <label>Enable logging reports requests</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>If enabled, the extension will log reports requests details into the system.log file</comment>
                </field>
            </group>
        </section>
    </system>
</config>
