<?xml version="1.0"?>
<!--
/**
 * Copyright © MageWorx. All rights reserved.
 * See LICENSE.txt for license details.
 */
 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="mageworx" sortOrder="2001">
            <label>MageWorx</label>
        </tab>
        <section id="mageworx_shipping_calculator" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Shipping Calculator</label>
            <tab>mageworx</tab>
            <resource>MageWorx_ShippingCalculatorBase::config_main</resource>
            <group id="main" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Shipping Calculator Configuration</label>
                <field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Enable Shipping Calculator]]></label>
                    <comment><![CDATA[This setting displays or hides the shipping cost calculator on the product pages.]]></comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="calculate_on_load" translate="label" type="select" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Display available shipping methods after page load]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="calculate_by_country" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Calculate by Country]]></label>
                    <comment><![CDATA[This setting defines if the country field is available for selection by your customers in the shipping cost calculator.]]></comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="country_required" translate="label comment" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Is Country Required]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="calculate_by_country">1</field>
                    </depends>
                </field>
                <field id="calculate_by_region" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Calculate by State/Region]]></label>
                    <comment><![CDATA[This setting defines if the state/region field is available for selection by your customers in the shipping cost calculator. This option is enabled if the Country field is enabled only.]]></comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="region_required" translate="label comment" type="select" sortOrder="35" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Is Region Required]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="calculate_by_region">1</field>
                    </depends>
                </field>
                <field id="calculate_by_zip" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Calculate by Zip]]></label>
                    <comment><![CDATA[This setting defines if the zip code field is available for selection by your customers in the shipping cost calculator.]]></comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="zip_required" translate="label comment" type="select" sortOrder="42" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Is Zip Code Required]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="calculate_by_zip">1</field>
                    </depends>
                </field>

                <field id="highlight_cheapest_method" translate="label comment" type="select" sortOrder="45" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Highlight the cheapest method]]></label>
                    <comment><![CDATA[If enabled, the cheapest shipping method will be highlighted on the product page on the front-end.]]></comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>

                <field id="title" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Calculator Title</label>
                    <comment><![CDATA[This setting allows you to specify a title of the shipping cost calculator. This title will be used as the tab name if the display mode is set to “Separate tab”.]]></comment>
                </field>
                <field id="description" translate="label comment" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Calculator Description</label>
                    <comment><![CDATA[This setting allows you to specify a description of the shipping cost calculator.]]></comment>
                </field>
                <field id="not_found_error" translate="label comment" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>“Not found” error</label>
                    <comment><![CDATA[This setting allows you to specify an error message, which will appear if there are no available shipping methods for selected area.]]></comment>
                </field>
            </group>

            <group id="shipping_methods" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Shipping Methods Settings</label>
                <field id="configuration" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Shipping Methods Description</label>
                    <frontend_model>MageWorx\ShippingCalculatorBase\Block\Adminhtml\Form\Field\MethodsConfiguration</frontend_model>
                    <backend_model>MageWorx\ShippingCalculatorBase\Model\System\Config\Backend\MethodsConfiguration</backend_model>
                    <upload_dir config="system/filesystem/media" scope_info="1">mageworx/calculator/methods</upload_dir>
                    <base_url type="media" scope_info="1">mageworx/calculator/methods</base_url>
                </field>
            </group>
        </section>
    </system>
</config>
