<?xml version="1.0"?>
<!--
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\View\File\FileList\Collator">
        <plugin name="file_collator_plugin" type="Hyva\Theme\Plugin\File\FileList\CollatorPlugin"/>
    </type>

    <type name="Magento\Framework\View\TemplateEngine\Php">
        <plugin name="php_template_engine_plugin" type="Hyva\Theme\Plugin\TemplateEngine\PhpPlugin"/>
    </type>

    <type name="Magento\Deploy\Package\Package">
        <plugin name="deploy_package_exclude_tailwind_from_deployment"
                type="Hyva\Theme\Plugin\Deploy\Package\ExcludeTailwindPlugin"
                sortOrder="99999"/>
    </type>

    <type name="Magento\Tax\Pricing\Render\Adjustment">
        <plugin name="fix_core_type_php81_error" type="Hyva\Theme\Plugin\Tax\PriceAdjustmentRendererFixPlugin"/>
    </type>

    <type name="Magento\Framework\Filter\SimpleDirective\ProcessorPool">
        <arguments>
            <argument name="processors" xsi:type="array">
                <item name="icon" xsi:type="object">Hyva\Theme\Model\Template\IconProcessor</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Composite">
        <arguments>
            <argument name="customizableOptionValues" xsi:type="array">
                <item name="file"
                      xsi:type="string">Hyva\Theme\Model\CartItem\DataProvider\CustomizableOptionValue\File
                </item>
            </argument>
        </arguments>
    </type>

    <!-- Add the hyva:config:generate CLI command -->
    <type name="Magento\Framework\Console\CommandListInterface">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="HyvaConfigGenerate" xsi:type="object">Hyva\Theme\Console\Command\HyvaConfigGenerate</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Framework\App\DeploymentConfig\Writer">
        <plugin name="hyva_theme" type="Hyva\Theme\Plugin\HyvaModulesConfig\UpdateOnModuleStatusChange"/>
    </type>
    <type name="Magento\Deploy\Console\Command\App\ConfigImport\Processor">
        <plugin name="hyva_theme" type="Hyva\Theme\Plugin\HyvaModulesConfig\UpdateOnModuleStatusChange"/>
    </type>

    <type name="Magento\Framework\View\Asset\PreProcessor\Minify">
        <plugin name="hyva_theme" type="Hyva\Theme\Plugin\Theme\DisableJsAndCssMinifierForHyvaPlugin"/>
    </type>
    <type name="\Magento\Framework\View\Template\Html\Minifier">
        <plugin name="hyva_theme" type="\Hyva\Theme\Plugin\Theme\DisableHtmlMinifierForHyvaPlugin"/>
    </type>

    <type name="Magento\Framework\App\Response\Http">
        <plugin name="hyva_theme" type="Hyva\Theme\Plugin\Theme\RemoveNoStoreHeaderPlugin"/>
    </type>

    <type name="\Adyen\Payment\Helper\Data">
        <plugin name="platform_meta_data_v9" type="\Hyva\Theme\Plugin\Platform\AddPlatformMetaData"/>
    </type>
    <type name="\Adyen\Payment\Helper\PlatformInfo">
        <plugin name="platform_meta_data_v10" type="\Hyva\Theme\Plugin\Platform\AddPlatformMetaData"/>
    </type>

    <type name="Hyva\Theme\ViewModel\HeroiconsSolid">
        <arguments>
            <argument name="iconPathPrefix" xsi:type="string">Hyva_Theme::svg/heroicons/solid</argument>
        </arguments>
    </type>
    <type name="Hyva\Theme\ViewModel\HeroiconsOutline">
        <arguments>
            <argument name="iconPathPrefix" xsi:type="string">Hyva_Theme::svg/heroicons/outline</argument>
        </arguments>
    </type>
    <type name="Hyva\Theme\ViewModel\LucideIcons">
        <arguments>
            <argument name="iconPathPrefix" xsi:type="string">Hyva_Theme::svg/lucide</argument>
        </arguments>
    </type>

    <preference for="Hyva\Theme\Block\SortableItemInterface" type="Hyva\Theme\Block\SortableItem"/>
    <preference for="Hyva\Theme\Model\Media\MediaHtmlProviderInterface" type="Hyva\Theme\Model\Media\MediaHtmlProvider"/>

    <type name="Hyva\Theme\Service\HyvaThemes">
        <arguments>
            <argument name="hyvaBaseThemes" xsi:type="array">
                <!-- Keep Hyva/reset in this list to support older installations that use it. -->
                <item name="Hyva/reset" xsi:type="boolean">true</item>
                <item name="Hyva/default" xsi:type="boolean">true</item>
                <item name="Hyva/default-csp" xsi:type="boolean">true</item>
            </argument>
        </arguments>
    </type>
</config>
