<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <!-- Theme -->
        <service id="Shopware\Storefront\Theme\StorefrontPluginConfiguration\StorefrontPluginConfigurationFactory">
            <argument type="service" id="Shopware\Core\Framework\Plugin\KernelPluginLoader\KernelPluginLoader"/>
            <argument type="service" id="Shopware\Core\Framework\App\Source\SourceResolver"/>
        </service>

        <service id="Shopware\Storefront\Theme\StorefrontPluginRegistry" public="true">
            <argument type="service" id="kernel"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginConfiguration\StorefrontPluginConfigurationFactory"/>
            <argument type="service" id="Shopware\Core\Framework\App\ActiveAppsLoader"/>

            <tag name="kernel.reset" method="reset"/>
        </service>

        <service id="Shopware\Storefront\Theme\ScssPhpCompiler" />

        <service id="Shopware\Storefront\Theme\ThemeCompiler">
            <argument type="service" id="shopware.filesystem.theme"/>
            <argument type="service" id="shopware.filesystem.temp"/>
            <argument type="service" id="Shopware\Core\Framework\Adapter\Filesystem\Plugin\CopyBatchInputFactory" />
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFileResolver" />
            <argument>%kernel.debug%</argument>
            <argument type="service" id="Symfony\Component\EventDispatcher\EventDispatcherInterface" />
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFilesystemResolver" />
            <argument type="tagged_iterator" tag="shopware.asset"/>
            <argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheInvalidator"/>
            <argument type="service" id="Psr\Log\LoggerInterface"/>
            <argument type="service" id="Shopware\Storefront\Theme\AbstractThemePathBuilder"/>
            <argument type="service" id="Shopware\Storefront\Theme\ScssPhpCompiler"/>
            <argument>%storefront.theme.allowed_scss_values%</argument>
            <argument>%storefront.theme.validate_on_compile%</argument>
            <argument>%shopware.filesystem.theme.visibility%</argument>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeLifecycleService">
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="media.repository"/>
            <argument type="service" id="media_folder.repository"/>
            <argument type="service" id="theme_media.repository"/>
            <argument type="service" id="Shopware\Core\Content\Media\File\FileSaver"/>
            <argument type="service" id="Shopware\Core\Content\Media\File\FileNameProvider"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFilesystemResolver"/>
            <argument type="service" id="language.repository"/>
            <argument type="service" id="theme_child.repository"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginConfiguration\StorefrontPluginConfigurationFactory" on-invalid="null"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeFileResolver">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFilesystemResolver"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeScripts">
            <argument type="service" id="request_stack"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeMergedConfigBuilder">
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="theme.repository"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeService">
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="theme_sales_channel.repository"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeCompiler"/>
            <argument type="service" id="Shopware\Storefront\Theme\ScssPhpCompiler"/>
            <argument type="service" id="event_dispatcher"/>
            <argument type="service" id="Shopware\Storefront\Theme\ConfigLoader\AbstractConfigLoader"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
            <argument type="service" id="messenger.default_bus"/>
            <argument type="service" id="Shopware\Core\Framework\Notification\NotificationService"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeMergedConfigBuilder"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>
        </service>

        <service id="Shopware\Storefront\Theme\ResolvedConfigLoader" lazy="true">
            <argument type="service" id="media.repository"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>
        </service>

        <service id="Shopware\Storefront\Theme\CachedResolvedConfigLoader">
            <argument type="service" id="Shopware\Storefront\Theme\ResolvedConfigLoader"/>
            <deprecated package="shopware/core" version="6.8.0">tag:v6.8.0 - The %service_id% service will be removed in v6.8.0.0 without replacement</deprecated>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeConfigCacheInvalidator">
            <argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheInvalidator"/>

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeLifecycleHandler">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleService"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>


        <service id="Shopware\Storefront\Theme\ThemeAppLifecycleHandler">
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginConfiguration\StorefrontPluginConfigurationFactory"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleHandler"/>

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\ConfigLoader\DatabaseAvailableThemeProvider">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>

        <service id="Shopware\Storefront\Theme\ConfigLoader\DatabaseConfigLoader">
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="media.repository"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeRuntimeConfigStorage">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeRuntimeConfigService">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFileResolver"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeMergedConfigBuilder"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigStorage"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="cache.object"/>
        </service>

        <service id="Shopware\Storefront\Theme\SeedingThemePathBuilder" lazy="true">
            <argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
        </service>

        <service id="Shopware\Storefront\Theme\MD5ThemePathBuilder"/>

        <service id="Shopware\Storefront\Theme\Message\DeleteThemeFilesHandler">
            <argument type="service" id="shopware.filesystem.theme"/>
            <argument type="service" id="Shopware\Storefront\Theme\AbstractThemePathBuilder"/>

            <tag name="messenger.message_handler" />
        </service>

        <service id="Shopware\Storefront\Theme\Message\CompileThemeHandler">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeCompiler"/>
            <argument type="service" id="Shopware\Storefront\Theme\ConfigLoader\AbstractConfigLoader"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="Shopware\Core\Framework\Notification\NotificationService"/>
            <argument type="service" id="sales_channel.repository" />
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>

            <tag name="messenger.message_handler" />
        </service>

        <service id="Shopware\Storefront\Theme\ScheduledTask\DeleteThemeFilesTask">
            <tag name="shopware.scheduled.task"/>
        </service>

        <service id="Shopware\Storefront\Theme\ScheduledTask\DeleteThemeFilesTaskHandler">
            <argument type="service" id="scheduled_task.repository"/>
            <argument type="service" id="logger"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="shopware.filesystem.theme"/>
            <argument type="service" id="Shopware\Storefront\Theme\AbstractThemePathBuilder"/>

            <tag name="messenger.message_handler"/>
        </service>

        <service id="Shopware\Storefront\Theme\ConfigLoader\StaticFileConfigLoader">
            <argument type="service" id="shopware.filesystem.private"/>
        </service>

        <service id="Shopware\Storefront\Theme\ConfigLoader\StaticFileAvailableThemeProvider">
            <argument type="service" id="shopware.filesystem.private"/>
        </service>

        <service id="Shopware\Storefront\Theme\ConfigLoader\StaticFileConfigDumper">
            <argument type="service" id="Shopware\Storefront\Theme\ConfigLoader\DatabaseConfigLoader"/>
            <argument type="service" id="Shopware\Storefront\Theme\ConfigLoader\DatabaseAvailableThemeProvider"/>
            <argument type="service" id="shopware.filesystem.private"/>
            <argument type="service" id="shopware.filesystem.temp"/>
            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="shopware.asset.theme" class="Shopware\Storefront\Theme\ThemeAssetPackage" lazy="true">
            <argument type="collection">
                <argument>%shopware.filesystem.theme.url%</argument>
            </argument>
            <argument type="service" id="shopware.asset.theme.version_strategy"/>
            <argument type="service" id="request_stack"/>
            <argument type="service" id="Shopware\Storefront\Theme\AbstractThemePathBuilder"/>
            <tag name="shopware.asset" asset="theme"/>
        </service>

        <!-- Entity definitions -->
        <service id="Shopware\Storefront\Theme\ThemeDefinition">
            <tag name="shopware.entity.definition"/>
        </service>

        <service id="Shopware\Storefront\Theme\Aggregate\ThemeTranslationDefinition">
            <tag name="shopware.entity.definition"/>
        </service>

        <service id="Shopware\Storefront\Theme\Aggregate\ThemeSalesChannelDefinition">
            <tag name="shopware.entity.definition"/>
        </service>

        <service id="Shopware\Storefront\Theme\Aggregate\ThemeMediaDefinition">
            <tag name="shopware.entity.definition"/>
        </service>

        <service id="Shopware\Storefront\Theme\Aggregate\ThemeChildDefinition">
            <tag name="shopware.entity.definition"/>
        </service>

        <!-- Entity extensions -->
        <service id="Shopware\Storefront\Theme\Extension\SalesChannelExtension">
            <tag name="shopware.entity.extension"/>
        </service>

        <service id="Shopware\Storefront\Theme\Extension\LanguageExtension">
            <tag name="shopware.entity.extension"/>
        </service>

        <service id="Shopware\Storefront\Theme\Extension\MediaExtension">
            <tag name="shopware.entity.extension"/>
        </service>

        <!-- Controller -->
        <service id="Shopware\Storefront\Theme\Controller\ThemeController" public="true">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>
            <argument type="service" id="Shopware\Storefront\Theme\ScssPhpCompiler"/>
            <argument>%storefront.theme.allowed_scss_values%</argument>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <!--  Commands -->
        <service id="Shopware\Storefront\Theme\Command\ThemeCreateCommand">
            <argument>%kernel.project_dir%</argument>

            <tag name="console.command"/>
        </service>

        <service id="Shopware\Storefront\Theme\Command\ThemeChangeCommand">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="sales_channel.repository"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="theme_sales_channel.repository"/>
            <argument type="service" id="media_thumbnail.repository"/>

            <tag name="console.command"/>
        </service>

        <service id="Shopware\Storefront\Theme\Command\ThemeCompileCommand">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>
            <argument type="service" id="Shopware\Storefront\Theme\ConfigLoader\AbstractAvailableThemeProvider"/>

            <tag name="console.command"/>
        </service>

        <service id="Shopware\Storefront\Theme\Command\ThemeDumpCommand">
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFileResolver"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="Shopware\Storefront\Theme\ConfigLoader\StaticFileConfigDumper"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeFilesystemResolver"/>

            <tag name="console.command"/>
        </service>

        <service id="Shopware\Storefront\Theme\Command\ThemeRefreshCommand">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleService"/>

            <tag name="console.command"/>
        </service>

        <service id="Shopware\Storefront\Theme\Command\ThemePrepareIconsCommand">

            <tag name="console.command"/>
        </service>

        <!-- Subscriber -->
        <service id="Shopware\Storefront\Theme\Subscriber\PluginLifecycleSubscriber">
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>
            <argument>%kernel.project_dir%</argument>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginConfiguration\StorefrontPluginConfigurationFactory"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleHandler"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleService"/>

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\Twig\ThemeInheritanceBuilderInterface"
                 class="Shopware\Storefront\Theme\Twig\ThemeInheritanceBuilder">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>
        </service>

        <service id="Shopware\Storefront\Theme\Subscriber\AppLifecycleSubscriber">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleService"/>
            <argument type="service" id="app.repository"/>

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\Subscriber\ThemeCompilerEnrichScssVarSubscriber">
            <argument type="service" id="Shopware\Core\System\SystemConfig\Service\ConfigurationService"/>
            <argument type="service" id="Shopware\Storefront\Theme\StorefrontPluginRegistry"/>

            <tag name="kernel.event_subscriber"/>
        </service>

        <!-- Twig -->
        <service id="Shopware\Storefront\Theme\Twig\ThemeNamespaceHierarchyBuilder">
            <argument type="service" id="Shopware\Storefront\Theme\Twig\ThemeInheritanceBuilderInterface"/>
            <argument type="service" id="Shopware\Storefront\Theme\DatabaseSalesChannelThemeLoader"/>

            <tag name="kernel.event_subscriber" />
            <tag name="kernel.reset" method="reset"/>

            <!-- Make sure it runs after default `BundleHierarchyBuilder` -->
            <tag name="shopware.twig.hierarchy_builder" priority="500"/>
        </service>

        <service id="Shopware\Storefront\Theme\Subscriber\FirstRunWizardSubscriber">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleService"/>
            <argument type="service" id="theme.repository" />
            <argument type="service" id="theme_sales_channel.repository" />
            <argument type="service" id="sales_channel.repository" />

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\Subscriber\UpdateSubscriber">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeLifecycleService"/>
            <argument type="service" id="sales_channel.repository" />

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\Subscriber\UnusedMediaSubscriber">
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="Shopware\Storefront\Theme\ThemeService"/>

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Storefront\Theme\DataAbstractionLayer\ThemeIndexer">
            <tag name="shopware.entity_indexer"/>
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common\IteratorFactory"/>
            <argument type="service" id="theme.repository"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="event_dispatcher"/>
        </service>

        <service id="Shopware\Storefront\Theme\DatabaseSalesChannelThemeLoader" public="true">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>

        <service id="Shopware\Storefront\Theme\DataAbstractionLayer\ThemeExceptionHandler">
            <tag name="shopware.dal.exception_handler"/>
        </service>

        <service id="Shopware\Storefront\Theme\ThemeFilesystemResolver" public="true">
            <argument type="service" id="Shopware\Core\Framework\App\Source\SourceResolver"/>
            <argument type="service" id="kernel"></argument>
        </service>

        <service id="Shopware\Storefront\Theme\Subscriber\ThemeSnippetsSubscriber">
            <argument type="service" id="Shopware\Storefront\Theme\ThemeRuntimeConfigService"/>
            <argument type="service" id="Shopware\Storefront\Theme\DatabaseSalesChannelThemeLoader"/>

            <tag name="kernel.event_subscriber"/>
        </service>
    </services>
</container>
