<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="duty_and_tax" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="100">
            <tab>zhik_extensions</tab>
            <class>separator-top</class>
            <label>Duties and Taxes</label>
            <resource>Zhik_DutyAndTax::config_DutyAndTax</resource>
            <group id="general" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General</label>
                <field id="status" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
                </field>
                <field id="tax_label" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Tax Label</label>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="duty_label" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Duty Label</label>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="duty_and_tax_label" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Duty &amp; Tax Label</label>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="enabled_countries" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
                    <label>Country List</label>
                    <comment>Shipping address countries that should have duties &amp; import taxes applied at checkout.
                        If duty or tax percent is specified, this value is used instead of the DHL calculator. </comment>
                    <frontend_model>Zhik\DutyAndTax\Block\Adminhtml\Config\Field\CountryAndThresholdTax</frontend_model>
                    <backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="enabled_groups" translate="label" type="multiselect" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="50">
                    <label>Enabled Customer Groups</label>
                    <comment>Customer groups that should have duties &amp; import taxes applied at checkout.</comment>
                    <source_model>\Amasty\SalesRuleWizard\Model\OptionsProvider\CustomerGroup</source_model>
                    <can_be_empty>1</can_be_empty>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="rate_limit_threshold" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Rate Limit Threshold</label>
                    <comment>Number or calls allowed within the specified timeframe from a single IP address</comment>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="rate_limit_timeframe" translate="label comment" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Rate Limit Timeframe</label>
                    <comment>Number of seconds to calculate the rate of api calls.</comment>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="global_rate_limit_threshold" translate="label comment" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Global Rate Limit Threshold</label>
                    <comment>Number or calls allowed within the specified timeframe for all IP addresses</comment>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="global_rate_limit_timeframe" translate="label comment" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Global Rate Limit Timeframe</label>
                    <comment>Number of seconds to calculate the global rate of api calls.</comment>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="rate_limit_notify_email" translate="label comment" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Rate Limit Notification Email</label>
                    <comment>Send rate limit exceeded notification to this email address, disabled if blank</comment>
                    <depends>
                        <field id="*/general/status">1</field>
                    </depends>
                </field>
                <field id="hs_source" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>HS Code Source</label>
                    <source_model>Zhik\DutyAndTax\Model\Config\Source\ProductAttributes</source_model>
                </field>
            </group>
            <group id="dhl_connection" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>API Connection</label>
                <depends>
                    <field id="*/general/status">1</field>
                </depends>
                <field id="sandbox_mode" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Sandbox Mode</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="client_id" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL API Client ID</label>
                    <depends>
                        <field id="*/*/sandbox_mode">0</field>
                    </depends>
                </field>
                <field id="client_id_sandbox" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL Sandbox API Client ID</label>
                    <depends>
                        <field id="*/*/sandbox_mode">1</field>
                    </depends>
                </field>
                <field id="client_secret" translate="label comment" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL API Client Secret</label>
                    <depends>
                        <field id="*/*/sandbox_mode">0</field>
                    </depends>
                    <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                </field>
                <field id="client_secret_sandbox" translate="label comment" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL Sandbox API Client Secret</label>
                    <depends>
                        <field id="*/*/sandbox_mode">1</field>
                    </depends>
                    <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                </field>
                <field id="api_url" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL API URL</label>
                    <comment>Production URL for DHL API</comment>
                    <depends>
                        <field id="*/*/sandbox_mode">0</field>
                    </depends>
                </field>
                <field id="api_url_sandbox" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL Sandbox API URL</label>
                    <comment>Sandbox URL for DHL API </comment>
                    <depends>
                        <field id="*/*/sandbox_mode">1</field>
                    </depends>
                </field>
                <field id="pickup_account_number" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL Pickup Account Number</label>
                    <depends>
                        <field id="*/*/sandbox_mode">0</field>
                    </depends>
                </field>
                <field id="pickup_account_number_sandbox" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>DHL Sandbox Pickup Account Number</label>
                    <depends>
                        <field id="*/*/sandbox_mode">1</field>
                    </depends>
                </field>
            </group>
        </section>
        <section id="sales">
            <group id="totals_sort">
                <field id="duty_and_tax" translate="label" sortOrder="20" type="text" showInDefault="1" showInWebsite="1">
                    <label>Import Duty &amp; Tax</label>
                </field>
            </group>
        </section>
	</system>
</config>
