services:
    _defaults:
        autoconfigure: true

    contao.routing.frontend_loader:
        class: Contao\CoreBundle\Routing\FrontendLoader
        arguments:
            - '%contao.prepend_locale%'
            - '%contao.url_suffix%'
        tags:
            - routing.loader

    contao.routing.candidates:
        class: Contao\CoreBundle\Routing\Candidates\LegacyCandidates
        arguments:
            - '%contao.prepend_locale%'
            - '%contao.url_suffix%'

    contao.routing.legacy_matcher:
        class: Contao\CoreBundle\Routing\Matcher\LegacyMatcher
        decorates: contao.routing.nested_matcher
        arguments:
            - '@contao.framework'
            - '@contao.routing.legacy_matcher.inner'
            - '%contao.url_suffix%'
            - '%contao.prepend_locale%'

    Contao\CoreBundle\EventListener\DataContainer\LegacyRoutingListener:
        arguments:
            - '@contao.framework'
            - '@translator'
            - '%contao.prepend_locale%'
            - '%contao.url_suffix%'

    contao.routing.legacy_router:
        class: Symfony\Cmf\Component\Routing\DynamicRouter
        arguments:
            - '@router.request_context'
            - !service
              class: Contao\CoreBundle\Routing\Matcher\UrlMatcher
            - !service
              class: Symfony\Cmf\Component\Routing\ProviderBasedGenerator
              arguments:
                  - '@contao.routing.legacy_route_provider'
                  - '@logger'
            - ''
            - '@event_dispatcher'
        tags:
            - router

    contao.routing.legacy_route_provider:
        class: Contao\CoreBundle\Routing\LegacyRouteProvider
        arguments:
            - '@contao.routing.frontend_loader'

    contao.routing.url_generator:
        class: Contao\CoreBundle\Routing\UrlGenerator
        arguments:
            - '@router'
            - '@contao.framework'
            - '%contao.prepend_locale%'
        public: true
