<?xml version="1.0"?>
<!--
/**
 * Mondial Relay & InPost Shipping Module
 *
 * @author    Magentix
 * @copyright Copyright © 2025 Magentix. All rights reserved.
 * @license   https://www.magentix.fr/en/licence.html Magentix Software Licence
 * @link      https://mondialrelay.magentix.fr/
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="carriers" translate="label" type="text" sortOrder="320" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="mondialrelay" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Mondial Relay &amp; InPost</label>
                <field id="version" translate="label" type="label" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Version</label>
                    <backend_model>MondialRelay\Shipping\Model\Config\Source\Version</backend_model>
                </field>
                <field id="active" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="title" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Title</label>
                </field>
                <field id="collection_mode" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Collection Mode</label>
                    <source_model>MondialRelay\Shipping\Model\Config\Source\CollectionMode</source_model>
                </field>
                <field id="api_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>MR API URL</label>
                </field>
                <field id="api_company" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>MR API Company</label>
                </field>
                <field id="api_key" translate="label" type="password" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>MR API Key</label>
                </field>
                <field id="api_reference" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>MR API Brand Code</label>
                </field>
                <field id="api_test" translate="label" type="button" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
                    <frontend_model>MondialRelay\Shipping\Block\Adminhtml\System\Config\Api\Test\V1</frontend_model>
                    <label>Test API V1 credentials</label>
                </field>
                <field id="api_v2_enabled" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>API V2</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>API V2 enables home delivery in Europe with Dual Carrier. You need to enable API V2 in your merchant account.</comment>
                </field>
                <field id="api_v2_mode" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>Mode</label>
                    <source_model>MondialRelay\Shipping\Model\Config\Source\ApiMode</source_model>
                    <depends>
                        <field id="api_v2_enabled">1</field>
                    </depends>
                </field>
                <field id="api_v2_customer_id" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>MR Brand Id API</label>
                    <depends>
                        <field id="api_v2_enabled">1</field>
                    </depends>
                </field>
                <field id="api_v2_login" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>MR Login API</label>
                    <depends>
                        <field id="api_v2_enabled">1</field>
                    </depends>
                </field>
                <field id="api_v2_password" translate="label" type="password" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>MR Password API</label>
                    <depends>
                        <field id="api_v2_enabled">1</field>
                    </depends>
                </field>
                <!--
                <field id="api_v2_test" translate="label" type="button" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
                    <frontend_model>MondialRelay\Shipping\Block\Adminhtml\System\Config\Api\Test\V2</frontend_model>
                    <label>Test API V2 credentials</label>
                    <depends>
                        <field id="api_v2_enabled">1</field>
                    </depends>
                </field>
                -->
                <field id="log_enabled" translate="label" type="select" sortOrder="140" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Enable Log</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>API requests and errors are logged in var/log/{mondialrelay|inpost}.log</comment>
                </field>
                <field id="sort_order" translate="label" type="text" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Sort Order</label>
                </field>
                <field id="showmethod" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Show Method if Not Applicable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="specificerrmsg" translate="label" type="textarea" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Displayed Error Message</label>
                </field>
                <include path="MondialRelay_Shipping::system/pickup.xml"/>
                <include path="MondialRelay_Shipping::system/locker.xml"/>
                <include path="MondialRelay_Shipping::system/standard.xml"/>
                <include path="MondialRelay_Shipping::system/label.xml"/>
                <include path="MondialRelay_Shipping::system/return.xml"/>
                <include path="MondialRelay_Shipping::system/limitation.xml"/>
            </group>
        </section>
    </system>
</config>
