<?xml version="1.0"?>
<!--
/**
 * Avalara_AvaTax
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @copyright  Copyright (c) 2016 Avalara, Inc.
 * @license    http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.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="tax">
            <group id="avatax_configuration" translate="label comment" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="0">
                <label>AvaTax Configuration</label>
                <comment><![CDATA[For complete and up-to-date documentation, please visit <a href="https://knowledge.avalara.com/bundle/usd1665121460439_usd1665121460439/page/dbj1665121622352.html" target="_blank">Avalara for Adobe Commerce</a>.
                            ]]></comment>
                <field id="avatax_extension_version" translate="label" type="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Avalara Extension Version:</label>
                    <comment model="Avalara\AvaTax\Model\Config\Comment" />
                </field>
                <field id="enabled" translate="label" type="hidden" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label/>
                    <config_path>tax/avatax/enabled</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\CommonJs</frontend_model>
                    <backend_model>Avalara\AvaTax\Model\Config\Backend\CacheClean</backend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>
                <field id="ecm_subscription" type="hidden" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/ecm_subscription</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\RemoveLabel</frontend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>
                <field id="product_sync_subscription" type="hidden" showInDefault="1" showInWebsite="0" showInStore="0">
                    <config_path>tax/avatax/product_sync_subscription</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\RemoveLabel</frontend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>
                <field id="address_validation_hidden" type="hidden" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/address_validation_hidden</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\RemoveLabel</frontend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>
                <field id="crossborder_hidden" type="hidden" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/crossborder_hidden</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\RemoveLabel</frontend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>                
                <field id="live_mode" translate="label" type="select" sortOrder="12" showInDefault="0" showInWebsite="0" showInStore="0">
                    <config_path>tax/avatax/live_mode</config_path>
                    <source_model>Avalara\AvaTax\Model\Config\Source\Mode</source_model>
                    
                </field>
                <field id="account_number" translate="label" type="text" sortOrder="13" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/account_number</config_path>
                    <label>Account ID</label>
                    <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                </field>
                <field id="license_key" translate="label" type="obscure" sortOrder="14" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/license_key</config_path>
                    <label>License Key</label>
                    <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                    <comment><![CDATA[Can’t find the license key? <a href="https://knowledge.avalara.com/bundle/dqa1657870670369_dqa1657870670369/page/License_keys.html" target="_blank">Learn how you can get a new license key</a>.]]></comment>
                </field>
                <field id="account_number_hidden" type="hidden" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/account_number_hidden</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\RemoveLabel</frontend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>
                <field id="license_key_hidden" type="hidden" showInDefault="1" showInWebsite="1" showInStore="1">
                    <config_path>tax/avatax/license_key_hidden</config_path>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\RemoveLabel</frontend_model>
                    <frontend_class>hidden-field</frontend_class>
                </field>
                <field id="validate_account" translate="button_label" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label/>
                    <button_label>Connect</button_label>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\ConnectButtons</frontend_model>
                    <depends>
                        <field id="enabled">0</field>
                    </depends>
                </field>
                <field id="disconnect_update_connection" translate="button_label" sortOrder="16" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label/>
                    <button_label>Disconnect</button_label>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\DisconnectUpdateButton</frontend_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="avatax_company_message_label" translate="label" sortOrder="17" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label/>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\CompanyLabel</frontend_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="avatax_settings_link" translate="label" type="link" sortOrder="18" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label/>
                    <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\SettingLink</frontend_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                         
                <frontend_model>Avalara\AvaTax\Block\Adminhtml\System\Config\AvaTax</frontend_model>
                <include path="Avalara_AvaTax::system/sales_tax.xml"/>
                <include path="Avalara_AvaTax::system/address_validation.xml"/>
                <include path="Avalara_AvaTax::system/cross_border.xml"/>
                <include path="Avalara_AvaTax::system/exemption_certcapture_management.xml"/>
                <include path="Avalara_AvaTax::system/one_way_items_sync.xml"/>
                <include path="Avalara_AvaTax::system/error_logs_and_queue.xml"/>
                <include path="Avalara_AvaTax::system/advanced.xml"/>
            </group>
            <group id="classes">
                <field id="shipping_tax_class">
                    <comment>This setting will be ignored if AvaTax is enabled, as shipping Tax Code is hard-coded as FR020100 and AvaTax will determine whether tax applies to an order.</comment>
                </field>
                <field id="wrapping_tax_class">
                    <comment>This setting applies only to gift wrapping options, not Gift Cards; if AvaTax is enabled, the Gift Card Tax Code is hard-coded as PG050000 and AvaTax will determine whether tax applies to an order for a Gift Card.</comment>
                </field>
            </group>
            <group id="calculation">
                <field id="algorithm">
                    <comment>This setting will be ignored if AvaTax is enabled, as AvaTax always calculates tax on a row level.</comment>
                </field>
                <field id="based_on">
                    <comment>This setting will be ignored if AvaTax is enabled, as AvaTax always uses the shipping address for estimation.</comment>
                </field>
                <field id="price_includes_tax">
                    <comment>This setting will be ignored if AvaTax is enabled, as you must set your prices in Adobe Commerce without taxes included so that AvaTax is the single system of record for tax estimation.</comment>
                </field>
                <field id="shipping_includes_tax">
                    <comment>This setting will be ignored if AvaTax is enabled, as AvaTax must be responsible for calculating shipping tax.</comment>
                </field>
                <field id="apply_after_discount">
                    <comment>This setting will be ignored if AvaTax is enabled, as AvaTax doesn't support line-level discounts.</comment>
                </field>
                <field id="discount_tax">
                    <comment>This setting will be ignored if AvaTax is enabled, as AvaTax doesn't support line-level discounts.</comment>
                </field>
                <field id="apply_tax_on">
                    <comment>This setting will be ignored if AvaTax is enabled, as AvaTax should always calculate tax after discounts are applied in Adobe Commerce.</comment>
                </field>
                <field id="cross_border_trade_enabled">
                    <comment>This setting will be ignored if AvaTax is enabled.</comment>
                </field>
            </group>
            <group id="defaults">
                <field id="postcode">
                    <comment>If AvaTax is enabled, it is highly recommended that you leave this field blank. Otherwise, the number of AvaTax API requests will increase significantly, as every time a guest adds a product to their cart, AvaTax will calculate tax for the postal code entered above.</comment>
                </field>
            </group>
            <group id="weee">
                <field id="enable">
                    <comment>The AvaTax extension does not support the usage of Fixed Product Taxes, so do not enable this option.</comment>
                </field>
            </group>
        </section>
    </system>
</config>
