services:
    _defaults:
        autoconfigure: true

    _instanceof:
        Contao\CoreBundle\Framework\FrameworkAwareInterface:
            calls:
                - [setFramework, ['@contao.framework']]

        Symfony\Bundle\FrameworkBundle\Controller\AbstractController:
            calls:
                - [setContainer, ['@Psr\Container\ContainerInterface']]

        Symfony\Component\DependencyInjection\ContainerAwareInterface:
            calls:
                - [setContainer, ['@service_container']]

    marketing_suite.picker.link_shortener_provider:
        class: numero2\MarketingSuiteBundle\Picker\LinkShortenerPickerProvider
        arguments:
            - "@knp_menu.factory"
            - "@router"
        calls:
            - [setTokenStorage, ["@security.token_storage"]]
        tags:
            - { name: contao.picker_provider, priority: 96 }

    marketing_suite.controller.link_shortener:
        class: numero2\MarketingSuiteBundle\Controller\LinkShortenerController
        tags:
            - { name: controller.service_arguments }

    marketing_suite.routing.router:
        class: Symfony\Cmf\Component\Routing\DynamicRouter
        arguments:
            - '@router.request_context'
            - '@marketing_suite.routing.nested_matcher'
            - '@marketing_suite.routing.route_generator'
            - ''
            - '@event_dispatcher'
            - '@marketing_suite.routing.route_provider'
        tags:
            - { name: router, priority: 80 }

    marketing_suite.routing.nested_matcher:
        class: Symfony\Cmf\Component\Routing\NestedMatcher\NestedMatcher
        arguments:
            - '@marketing_suite.routing.route_provider'
            - '@marketing_suite.routing.final_matcher'

    marketing_suite.routing.final_matcher:
        class: Symfony\Cmf\Component\Routing\NestedMatcher\UrlMatcher
        arguments:
            - '@marketing_suite.routing.dummy_collection'
            - '@marketing_suite.routing.dummy_context'

    marketing_suite.routing.dummy_context:
        class: Symfony\Component\Routing\RequestContext

    marketing_suite.routing.dummy_collection:
        class: Symfony\Component\Routing\RouteCollection

    marketing_suite.routing.route_provider:
        class: numero2\MarketingSuiteBundle\Routing\LinkShortenerRouteProvider
        arguments:
            - "@contao.framework"

    marketing_suite.routing.route_generator:
        class: Symfony\Cmf\Component\Routing\ProviderBasedGenerator
        arguments:
            - '@marketing_suite.routing.route_provider'
            - '@logger'

    numero2\MarketingSuiteBundle\Controller\BackendController: ~
