<?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>
        <defaults public="true" />

        <service id="shopware_bundle_sitemap.service.sitemap_writer" class="Shopware\Bundle\SitemapBundle\Service\SitemapWriter">
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\SitemapNameGenerator"/>
            <argument type="service" id="Shopware\Components\Filesystem\PrefixFilesystem"/>
            <argument type="service" id="corelogger"/>
        </service>

        <service id="shopware_bundle_sitemap.service.sitemap_name_generator"
                 class="Shopware\Bundle\SitemapBundle\Service\SitemapNameGenerator" >
            <argument type="service" id="Shopware\Components\Filesystem\PrefixFilesystem"/>
        </service>

        <service id="shopware_bundle_sitemap.service.sitemap_exporter" class="Shopware\Bundle\SitemapBundle\Service\SitemapExporter">
            <argument type="service" id="shopware_bundle_sitemap.service.sitemap_writer" />
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface" />
            <argument type="service" id="Shopware_Components_Config" />
            <argument type="tagged" tag="sitemap_url_provider" />
            <argument type="service" id="Shopware\Components\ConfigWriter" />
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\SitemapLock" />
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\UrlFilter"/>
        </service>

        <service id="shopware_bundle_sitemap.service.sitemap_lister" class="Shopware\Bundle\SitemapBundle\Service\SitemapLister">
            <argument type="service" id="Shopware\Components\Filesystem\PrefixFilesystem"/>
            <argument type="service" id="shopware.filesystem.public.url_generator"/>
        </service>

        <service id="shopware_bundle_sitemap.service.filesystem" class="Shopware\Components\Filesystem\PrefixFilesystem">
            <argument type="service" id="shopware.filesystem.public"/>
            <argument>sitemap</argument>
        </service>

        <service class="Shopware\Bundle\SitemapBundle\Service\SitemapLock" id="shopware_bundle_sitemap.service.sitemap_lock">
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Service\Core\CoreCache"/>
        </service>

        <!-- UrlProviders -->
        <service id="shopware_bundle_sitemap.provider.url.product"
                 class="Shopware\Bundle\SitemapBundle\Provider\ProductUrlProvider"
                 public="false">
            <argument type="service" id="Shopware\Components\Routing\RouterInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundle\ProductNumberSearchInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundle\StoreFrontCriteriaFactoryInterface"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument>%shopware.sitemap.batchsize%</argument>

            <tag name="sitemap_url_provider" />
        </service>

        <service id="shopware_bundle_sitemap.provider.url.static"
                 class="Shopware\Bundle\SitemapBundle\Provider\StaticUrlProvider"
                 public="false">
            <argument type="service" id="Shopware\Components\Routing\RouterInterface"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>

            <tag name="sitemap_url_provider" />
        </service>

        <service id="shopware_bundle_sitemap.provider.url.category"
                 class="Shopware\Bundle\SitemapBundle\Provider\CategoryUrlProvider"
                 public="false">
            <argument type="service" id="Shopware\Components\Model\ModelManager"/>
            <argument type="service" id="Shopware\Components\Routing\RouterInterface"/>

            <tag name="sitemap_url_provider" />
        </service>

        <service id="shopware_bundle_sitemap.provider.url.blog"
                 class="Shopware\Bundle\SitemapBundle\Provider\BlogUrlProvider"
                 public="false">
            <argument type="service" id="Shopware\Components\Model\ModelManager"/>
            <argument type="service" id="Shopware\Components\Routing\RouterInterface"/>
            <argument type="service" id="Shopware_Components_Translation"/>
            <tag name="sitemap_url_provider" />
        </service>

        <service id="shopware_bundle_sitemap.provider.url.manufacturer"
                 class="Shopware\Bundle\SitemapBundle\Provider\ManufacturerUrlProvider"
                 public="false">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Components\Routing\RouterInterface"/>

            <tag name="sitemap_url_provider" />
        </service>

        <service id="shopware_bundle_sitemap.provider.url.landingpage"
                 class="Shopware\Bundle\SitemapBundle\Provider\LandingPageUrlProvider"
                 public="false">
            <argument type="service" id="Shopware\Components\Model\ModelManager"/>
            <argument type="service" id="Shopware\Components\Routing\RouterInterface"/>

            <tag name="sitemap_url_provider" />
        </service>

        <service id="shopware_bundle_sitemap.provider.url.custom"
                 class="Shopware\Bundle\SitemapBundle\Provider\CustomUrlProvider"
                 public="false">
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\ConfigHandler"/>

            <tag name="sitemap_url_provider" />
        </service>

        <!-- URL filter -->
        <service id="shopware_bundle_sitemap.url_filter.product" class="Shopware\Bundle\SitemapBundle\UrlFilter\Product">
            <tag name="shopware.sitemap.url_filter" />
        </service>

        <service id="shopware_bundle_sitemap.url_filter.statics" class="Shopware\Bundle\SitemapBundle\UrlFilter\Statics">
            <tag name="shopware.sitemap.url_filter" />
        </service>

        <service id="shopware_bundle_sitemap.url_filter.manufacturer" class="Shopware\Bundle\SitemapBundle\UrlFilter\Manufacturer">
            <tag name="shopware.sitemap.url_filter" />
        </service>

        <service id="shopware_bundle_sitemap.url_filter.landing_page" class="Shopware\Bundle\SitemapBundle\UrlFilter\LandingPage">
            <tag name="shopware.sitemap.url_filter" />
        </service>

        <service id="shopware_bundle_sitemap.url_filter.category" class="Shopware\Bundle\SitemapBundle\UrlFilter\Category">
            <tag name="shopware.sitemap.url_filter" />
        </service>

        <service id="shopware_bundle_sitemap.url_filter.blog" class="Shopware\Bundle\SitemapBundle\UrlFilter\Blog">
            <tag name="shopware.sitemap.url_filter" />
        </service>

        <!-- Command -->
        <service id="shopware_bundle_sitemap.commands.sitemap_generate_command"
                 class="Shopware\Bundle\SitemapBundle\Commands\SitemapGenerateCommand">
            <tag name="console.command" command="sw:generate:sitemap"/>
        </service>

        <service id="shopware_bundle_sitemap.cronjob_subscriber" class="Shopware\Bundle\SitemapBundle\Subscriber\CronjobSubscriber">
            <argument type="service" id="Shopware_Components_Config"/>
            <argument type="service" id="Shopware\Components\Model\ModelManager"/>
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\SitemapExporter"/>
            <tag name="shopware.event_subscriber" />
        </service>

        <service id="shopware_bundle_sitemap.sitemap_controller" class="Shopware\Bundle\SitemapBundle\Controller\SitemapIndexXml">
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\SitemapLister"/>
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\SitemapExporter"/>
            <argument type="service" id="Shopware_Components_Config"/>
            <tag name="shopware.controller" module="frontend" controller="SitemapIndexXml"/>
        </service>

        <service id="shopware_bundle_sitemap.service.url_filter" class="Shopware\Bundle\SitemapBundle\Service\UrlFilter">
            <argument type="service" id="shopware_bundle_sitemap.service.filter_container_factory"/>
            <argument type="tagged" tag="shopware.sitemap.url_filter"/>
        </service>

        <service id="shopware_bundle_sitemap.service.filter_container_factory" class="Shopware\Bundle\SitemapBundle\Service\FilterContainerFactory">
            <argument type="service" id="Shopware\Bundle\SitemapBundle\Service\ConfigHandler"/>
        </service>

        <service id="shopware_bundle_sitemap.service.config_handler" class="Shopware\Bundle\SitemapBundle\Service\ConfigHandler">
            <argument type="tagged" tag="shopware.sitemap.config_handler"/>
        </service>

        <service id="shopware_bundle_sitemap.config_handler.file" class="Shopware\Bundle\SitemapBundle\ConfigHandler\File">
            <argument>%shopware.sitemap%</argument>
        </service>

        <service id="Shopware\Bundle\SitemapBundle\ConfigHandler\Database">
            <argument type="service" id="dbal_connection" />

            <tag name="shopware.sitemap.config_handler" />
        </service>
    </services>
</container>
