<?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_downloads" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <label><![CDATA[File Downloads & Product Attachments]]></label>
            <tab>mageworx</tab>
            <resource>MageWorx_Downloads::config_downloads</resource>
            <group id="main" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Main Settings</label>

                <field id="display_size" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Display File Size]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This setting shows/hides the file size that appears next to the downloadable file on the front-end.]]></comment>
                </field>

                <field id="size_precision" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[File Size Precision]]></label>
                    <source_model>MageWorx\Downloads\Model\Attachment\Source\FileSize</source_model>
                    <comment><![CDATA[This setting displays the file size in 1 of 3 values: Kilobytes, Megabytes or Auto. We generally recommend users to set it to Auto.]]></comment>
                    <depends>
                        <field id="display_size">1</field>
                    </depends>
                </field>

                <field id="group_by_section" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Group By Section]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This setting groups the files by the sections and displays the section name on the front-end.]]></comment>
                </field>

                <field id="sort_order" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Sort Order]]></label>
                    <source_model>MageWorx\Downloads\Model\Attachment\Source\SortOrder</source_model>
                    <comment><![CDATA[This setting arranges the files in the selected order: Alphabetical, Upload Date, Size, Number of Downloads.]]></comment>
                </field>

                <field id="hide_files" translate="label comment" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Hide files]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If set to Yes, then the user won't see the attachments that are set up to be shown for some other customer group. If this setting is set to No, then customers will see the files as a plain text but won’t be able to download them unless their customer group is in the allowed groups.]]></comment>
                </field>

                <field id="how_to_download_message" translate="label comment" type="textarea" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA['How to download' message]]></label>
                    <comment>
                        <![CDATA[This message is shown near the files that cannot be downloaded due to the restrictions by the customer groups on the front-end. You can use this message to persuade the users to Log in or Register. The available variables: <b>%login%</b> or <b>%register%</b>.]]>
                    </comment>
                    <depends>
                        <field id="hide_files">0</field>
                    </depends>
                </field>

                <field id="display_downloads" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Display the # of Downloads]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This setting shows your visitors how many times the file was downloaded. This number is updated when the page cache is refreshed.]]></comment>
                </field>
                <field id="add_to_new_order_email" translate="label comment" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Add files in 'New Order' emails]]></label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="product_downloads_tab_title" translate="label comment" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Product Downloads Tab Title]]></label>
                    <comment><![CDATA[This setting specifies the title of the tab with downloadable files on the product page, added by the module.]]></comment>
                </field>

                <field id="product_downloads_title" translate="label comment" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Product Downloads Block Title]]></label>
                    <comment><![CDATA[This setting specifies the title of the section with downloadable files on the product page, added by the module. This setting is used if your theme doesn't have the product tabs or display the tabs as the separate sections (like in Magento Commerce layout).]]></comment>
                </field>

                <field id="max_file_size" translate="label comment" type="text" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[Maximum File Size Allowed]]></label>
                    <comment><![CDATA[This setting allows you to limit the size of the uploaded files. If empty or greater than server limitation, server limitation will be applied.</br>
                                php.ini memory size format can be used (for example, "100k", "1m", etc).]]></comment>
                </field>

                <field id="file_downloads_title" translate="label comment" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[File Downloads Title]]></label>
                    <comment><![CDATA[This setting specifies the default title for the static block and widget with the downloadable files if it is not specified in the code snippet. See more details <a target="_blank" href="https://support.mageworx.com/manuals/download/#product-attachments-on-cms-page">here</a>]]></comment>
                </field>
            </group>
        </section>
    </system>
</config>
