<?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>
        <tab id="salesmanago" translate="label" sortOrder="10">
            <label>Manago AI</label>
        </tab>
        <section id="salesmanago_account_settings" translate="label" sortOrder="131" showInDefault="1" showInWebsite="0" showInStore="1">
            <class>separator-top</class>
            <label>Account Settings</label>
            <tab>salesmanago</tab>
            <resource>Benhauer_Salesmanago::benhauer_salesmanago</resource>

            <group id="smattention" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Attention</label>
                <attribute type="expanded">1</attribute>
                <field id="smattention" translate="label" type="label" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Note:</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\NotLoggedComment</frontend_model>
                </field>
            </group>
            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Account Settings</label>
                <attribute type="expanded">0</attribute>
                <field id="active" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Active</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Active</frontend_model>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="clientId" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Client ID</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Disable</frontend_model>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="endpoint" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Endpoint</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Disable</frontend_model>
                </field>
                <field id="smapp" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>smApp</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Disable</frontend_model>
                    <comment>
                        Manago AI application index.
                    </comment>
                </field>

                <field id="ownerEmail" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Contact owner email</label>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectOwnersList</source_model>
                </field>

                <field id="link" translate="label" type="label" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Click here to update owners list</label>
                    <frontend_model>Benhauer\Salesmanago\Block\Adminhtml\System\Config\Form\Field\Link</frontend_model>
                </field>

                <field id="synchronize" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Synchronize contacts statuses</label>
                    <comment>During new user registration, download the consent status of the contact from Manago AI</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="apiv3" translate="label" type="text" sortOrder="18" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Api v3 Settings</label>
                <attribute type="expanded">0</attribute>
                <field id="apiv3key" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Api Key V3</label>
                    <comment>
                        Manago AI API v3 uses a new and simpler authentication mechanism. The only authentication field required is a Header API-KEY containing your API key. You can create a new API key in Manago AI ➔ Integration Center ➔ API ➔ API v3.
                        Note: You can specify when your API key expires, as well as revoke an already created API key. If you have trouble with authentication, start by verifying that your API key is valid. The key status can be checked in the same place where you create new keys.
                    </comment>
                    <validate>validate-sm-apiv3key-empty</validate>
                    <backend_model>Benhauer\Salesmanago\Model\System\Config\Backend\Encrypted</backend_model>
                    <frontend_model>Benhauer\Salesmanago\Block\Adminhtml\System\Config\Form\Field\Obscure</frontend_model>
                </field>
                <field id="errorcallback" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Error callback</label>
                    <comment>Here you can see error callback for API v3 Errors callbacks.
                        Important: Your server must have SSL enabled to receive webhooks with error notices from Manago AI
                    </comment>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\DisableErrorCallback</frontend_model>
                </field>
            </group>
            <group id="apiDoubleOptIn" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Double Optin</label>
                <attribute type="expanded">0</attribute>
                <field id="useApiDoubleOptIn" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Double Opt In</label>
                    <comment>During new user subscription, use Double Opt In</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="doubleOptInEmailId" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Email ID</label>
                    <comment>Paste the ID of subscription confirmation email. You can find it in Email list ➔ Subscription confirmation ➔ Preview</comment>
                    <depends>
                        <field id="useApiDoubleOptIn">1</field>
                    </depends>
                    <validate>validate-equals-36-or-empty</validate>
                </field>
            </group>

            <group id="moduleSettings" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Module</label>
                <attribute type="expanded">0</attribute>
                <field id="processingMode" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Processing mode</label>
                    <comment>Type of processing data mode. Module could process data synchronously (by default) or asynchronous. Asynchronously mode require to run special worker for this module on server side. When you use asynchronously mode - module save data such update contact or event to send them later with help of server side worker process.
                        Synchronous mode sends data immediately when event have a place.</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectProcessingMode</source_model>
                </field>
                <field id="enableHookMethod" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Disable event handling via plugin method</label>
                    <comment>
                        <model>Benhauer\Salesmanago\Model\Config\Comment\EnableHookMethod</model>
                    </comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
        <section id="salesmanago_platform_settings" translate="label" sortOrder="133" showInDefault="1" showInWebsite="0" showInStore="1">
            <class>separator-top</class>
            <label>Magento 2 Settings</label>
            <tab>salesmanago</tab>
            <resource>Benhauer_Salesmanago::benhauer_salesmanago</resource>

            <group id="smattention" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Attention</label>
                <attribute type="expanded">1</attribute>
                <field id="smattention" translate="label" type="label" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Note:</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\NotLoggedComment</frontend_model>
                </field>
            </group>
            <group id="callbacks" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Callbacks</label>
                <field id="active" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Active</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Active</frontend_model>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <attribute type="expanded">0</attribute>
                <field id="callbackOptIn" translate="label" type="text" sortOrder="2" showInDefault="1"
                       showInWebsite="0" showInStore="1">
                    <label>Opt-in callback URL</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Disable</frontend_model>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="callbackOptOut" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Opt-out callback URL</label>
                    <frontend_model>Benhauer\Salesmanago\Block\System\Config\Form\Field\Disable</frontend_model>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="tags" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="0"
                   showInStore="1">
                <label>Tags</label>
                <attribute type="expanded">0</attribute>
                <field id="registration" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0"  showInStore="1">
                    <label>Registration tag</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>Tags assigned after registration (comma separated)</comment>
                    <validate>no-whitespace</validate>
                </field>
                <field id="login" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Login tag</label>
                    <comment>Tags assigned after customer login (comma separated)</comment>
                    <validate>no-whitespace</validate>
                </field>
                <field id="subscription" translate="label comment" type="text" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Subscription tag</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>Tags assigned after subscription to the newsletter (comma separated)</comment>
                    <validate>no-whitespace</validate>
                </field>
                <field id="purchase" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Purchase tag</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>Tags assigned after purchase (comma separated)</comment>
                    <validate>no-whitespace</validate>
                </field>
                <field id="purchaseGuest" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Guest purchase tag</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>Tags assigned after guest purchase (comma separated)</comment>
                    <validate>no-whitespace</validate>
                </field>
                <field id="customerDelete" translate="label comment" type="text" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Customer delete</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>Tags assigned after customer delete (comma separated)</comment>
                    <validate>no-whitespace</validate>
                </field>
            </group>
            <group id="contacts" translate="label" type="text" sortOrder="12" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Contacts</label>
                <attribute type="expanded">0</attribute>
                <field id="emailDomainsToIgnore" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Email domains to ignore</label>
                    <comment>Email domains without @ and space sight separated by comma</comment>
                    <validate>no-whitespace</validate>
                </field>
            </group>
            <group id="events" translate="label" type="text" sortOrder="12" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Events</label>
                <attribute type="expanded">0</attribute>
                <field id="location" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Location/Manago AI Store ID</label>
                    <comment>Unique store ID</comment>
                    <validate>validate-no-empty validate-sm-location</validate>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="productTypeId" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Product type ID</label>
                    <comment>Choose the parameter to be passed as the product ID</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectProductId</source_model>
                </field>
                <field id="productTypesToProcess" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Product types to process</label>
                    <comment>Product types to process separated by comma (available: simple, virtual, downloadable, configurable, grouped, bundle)</comment>
                </field>
                <field id="eventCookie" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Event cookie lifetime</label>
                    <comment>The time the cookie SMEVENT expires (h)</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectCookieLifeTime</source_model>
                </field>
                <field id="enableSquareBrackets" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Wrap details in square brackets []?</label>
                    <comment>The details will take the form [X],[Y],[Z]. Enable this if you require specific automation settings</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="cart" translate="label" type="text" sortOrder="13" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Cart</label>
                <attribute type="expanded">0</attribute>
                <field id="cartRecoveryRedirectTo" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>After cart recovery redirect to</label>
                    <comment>Chose place where client will be redirected after cart recovery</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectAfterCartRecovery</source_model>
                </field>
                <field id="abandonedCartRecoveryBehavior" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Abandoned cart recovery link behavior</label>
                    <comment>Choose whether the recovery link keeps the current cart or replaces it with abandoned cart products</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectAbandonedCartRecoveryBehavior</source_model>
                </field>
            </group>
            <group id="purchases" translate="label" type="text" sortOrder="14" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Purchases</label>
                <attribute type="expanded">0</attribute>
                <field id="purchaseProcessingType" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Purchase events processing type</label>
                    <comment>Here you can choose in which way PURCHASE events will be send to Manago AI</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectPurchaseProcessingType</source_model>
                </field>
                <field id="purchaseProcessingTypeSystemEvents" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>System events list</label>
                    <comment>Choose on which system event will be send PURCHASE event</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectSystemEventsForPurchase</source_model>
                    <depends>
                        <field id="purchaseProcessingType">1</field>
                    </depends>
                </field>
                <field id="purchaseValueAsBaseGrandTotal" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Set order GrandTotal(Base) as purchase event value</label>
                    <comment>After enable this option value of purchase event will be GrandTotal(Base), by default it is GrandTotal(Purchased)</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="purchaseValueWithoutShipment" translate="label comment" type="select" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Purchase event value without including the shipment cost</label>
                    <comment>After enabling this option, the value of the purchase event will be counted without including the shipment cost.</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="purchaseValueWithoutTax" translate="label comment" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Purchase event value without including the tax cost</label>
                    <comment>After enabling this option, the value of the purchase event will be counted without including the tax cost.</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="productcatalogs" translate="label" type="text" sortOrder="15" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Product Catalog setup</label>
                <attribute type="expanded">0</attribute>
                <field id="productcatalog" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Product Catalog</label>
                    <comment>Select Product Catalog for real-time synchronization</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectProductCatalogs</source_model>
                </field>
                <field id="link" translate="label" type="label" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Click here to refresh product catalogs list</label>
                    <frontend_model>Benhauer\Salesmanago\Block\Adminhtml\System\Config\Form\Field\LinkUpdateProductCatalogs</frontend_model>
                </field>
                <field id="activeProductsAreMarkedAs" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Active products are marked as available when</label>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectProductsAreMarkedAsAvailable</source_model>
                </field>
                <field id="mainProductPrice" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Main product price</label>
                    <comment>Choose how configurable parent products resolve their catalog price in SALESmanago.</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\SelectMainProductPrice</source_model>
                </field>
            </group>
            <group id="monitoring" translate="label" type="text" sortOrder="16" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Monitoring code features</label>
                <attribute type="expanded">0</attribute>
                <field id="monitoringCodeDisabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Enable Monitoring Code</label>
                    <comment>Enable monitoring code on pages</comment>
                    <source_model>Benhauer\Salesmanago\Model\Config\Source\ReversedYesno</source_model>
                </field>
                <field id="customJsEnabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Custom Js</label>
                    <comment>Custom js will be added to monitoring script</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="bannersEnabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Banners</label>
                    <comment>Banners will be added to monitoring script</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="popupJsEnabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>PopupJs</label>
                    <comment>PopupJs will be added to monitoring script</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="webPushNotificationsEnabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Enable Web Push notifications</label>
                    <comment>Allows Web Push notifications created in Manago AI to be displayed on your website.</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="cookies" translate="label" type="text" sortOrder="17" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Cookies features</label>
                <attribute type="expanded">0</attribute>
                <field id="cookiesTimeToLife" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Cookies life time </label>
                    <comment>Life time for all Manago AI cookies (except smevent) in days (greater than 0 and less than 8760)</comment>
                    <validate>integer validate-number validate-not-negative-number validate-length minimum-length-1 maximum-length-4 validate-greater-than-0 validate-less-than-8760</validate>
                </field>
            </group>
            <group id="connection" translate="label" type="text" sortOrder="18" showInDefault="1" showInWebsite="0" showInStore="1">
                <label>Connection features</label>
                <attribute type="expanded">0</attribute>
                <field id="retryrequestiftimeout" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Retry request in case of timeout</label>
                    <comment>
                        If this option enabled all requests to Manago AI will be repeated in case of time out exception
                    </comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="timeout" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Timeout</label>
                    <comment>The maximum number of seconds to allow cURL functions to execute (CURLOPT_TIMEOUT)</comment>
                    <validate>integer validate-number validate-not-negative-number validate-length minimum-length-1 validate-greater-than-0</validate>
                </field>
                <field id="timeoutms" translate="label comment" type="text" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Timeout ms</label>
                    <comment>
                        The maximum number of milliseconds to allow cURL functions to execute.
                        If libcurl is built to use the standard system name resolver, that portion
                        of the connect will still use full-second resolution for timeouts with a minimum
                        timeout allowed of one second.
                        (CURLOPT_TIMEOUT_MS)
                    </comment>
                    <validate>integer validate-number validate-not-negative-number validate-length minimum-length-1 validate-greater-than-0</validate>
                </field>
                <field id="connecttimeoutms" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="1">
                    <label>Connect timeout ms</label>
                    <comment>
                        The number of milliseconds to wait while trying to connect.
                        Use 0 to wait indefinitely. If libcurl is built to use the standard system
                        name resolver, that portion of the connect will still use full-second resolution
                        for timeouts with a minimum timeout allowed of one second.
                        (CURLOPT_CONNECTTIMEOUT_MS)
                    </comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <validate>integer validate-number validate-not-negative-number validate-length minimum-length-1 validate-greater-than-0</validate>
                </field>
            </group>
        </section>
    </system>
</config>
