#####################################
#           Event                   #
#####################################

services:

    #####################################
    #           Listener                #
    #####################################

    App\EventListener\RequestListener:
        arguments:
            $redirectionService: '@App\Service\Content\RedirectionService'
            $router: '@router'
            $entityManager: '@doctrine.orm.entity_manager'
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 21 }

    App\EventListener\ExceptionListener:
        arguments:
            $entityManager: '@doctrine.orm.entity_manager'
            $doctrineCommand: '@App\Command\DoctrineCommand'
            $tokenStorage: '@security.token_storage'
            $redirectionService: '@App\Service\Content\RedirectionService'
            $isDebug: '%kernel.debug%'
        tags:
            - { name: kernel.event_listener, event: kernel.exception }

    App\EventListener\LogoutListener:
        arguments:
            $router: '@router'
            $tokenStorage: '@security.token_storage'
            $translator: '@translator'

    App\EventListener\LastRouteListener:
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

    App\EventListener\OnlineListener:
        arguments:
            $tokenStorage: '@security.token_storage'
            $entityManager: '@doctrine.orm.entity_manager'
            $analyticService: '@App\Service\Content\AnalyticService'
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

    App\EventListener\UserListener:
        arguments:
            $tokenStorage: '@security.token_storage'
            $entityManager: '@doctrine.orm.entity_manager'
            $authorizationChecker: '@security.authorization_checker'
            $router: '@router'
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

    #####################################
    #           Subscriber              #
    #####################################

    App\EventSubscriber\LocaleSubscriber:
        arguments:
            $entityManager: '@doctrine.orm.entity_manager'
            $container: '@service_container'
            $defaultLocale: '%kernel.default_locale%'
        tags:
            - { name: kernel.event_subscriber, priority: 20 }

    App\EventSubscriber\SecurityPolicySubscriber:
        arguments:
            $nonceGenerator: '@App\Twig\Core\NonceExtension'
            $container: '@service_container'
            $kernel: '@kernel'
            $authorizationChecker: '@security.authorization_checker'
            $router: '@router'
        tags:
            - { name: kernel.event_subscriber, priority: 20 }