services:
    _defaults:
        autoconfigure: true

    contao_manager.cache.bundle_clearer:
        class: Contao\ManagerBundle\Cache\BundleCacheClearer
        arguments:
            - '@?filesystem'

    contao_manager.command.debug_plugins:
        class: Contao\ManagerBundle\Command\DebugPluginsCommand
        arguments:
            - '@kernel'

    contao_manager.command.dotenv_dump:
        class: Symfony\Component\Dotenv\Command\DotenvDumpCommand
        factory: '@contao_manager.dotenv.dump_command_factory'

    contao_manager.command.install_skeleton:
        class: Contao\ManagerBundle\Command\InstallSkeletonCommand
        arguments:
            - '%kernel.project_dir%'

    contao_manager.command.maintenance_mode:
        class: Contao\ManagerBundle\Command\MaintenanceModeCommand
        arguments:
            - '%kernel.project_dir%/var/maintenance.html'
            - '@twig'
            - '@contao.intl.locales'
            - '@translator'

    contao_manager.command.setup:
        class: Contao\ManagerBundle\Command\ContaoSetupCommand
        arguments:
            - '%kernel.project_dir%'
            - '%contao.web_dir%'
            - '%kernel.secret%'

    contao_manager.dotenv.dump_command_factory:
        class: Contao\ManagerBundle\Dotenv\DotenvDumpCommandFactory
        arguments:
            - '%kernel.project_dir%'
            - '%kernel.environment%'

    contao_manager.jwt_manager:
        public: true
        synthetic: true

    contao_manager.listener.backend_menu:
        class: Contao\ManagerBundle\EventListener\BackendMenuListener
        arguments:
            - '@security.helper'
            - '@router'
            - '@request_stack'
            - '@translator'
            - '%kernel.debug%'
            - '%contao_manager.manager_path%'
            - '@?contao_manager.jwt_manager'

    contao_manager.listener.doctrine_alter_table:
        class: Contao\ManagerBundle\EventListener\DoctrineAlterTableListener

    contao_manager.monolog.request_processor:
        class: Contao\ManagerBundle\Monolog\RequestProcessor

    contao_manager.plugin_loader:
        public: true
        synthetic: true

    contao_manager.routing.route_loader:
        class: Contao\ManagerBundle\Routing\RouteLoader
        public: true
        arguments:
            - '@routing.loader'
            - '@contao_manager.plugin_loader'
            - '@kernel'
            - '%kernel.project_dir%'

    contao_manager.twig.file_extension_filter_iterator:
        class: Contao\ManagerBundle\Twig\FileExtensionFilterIterator
        decorates: twig.template_iterator
        arguments:
            - '@contao_manager.twig.file_extension_filter_iterator.inner'

    # Autowiring aliases
    Contao\ManagerBundle\HttpKernel\JwtManager: '@contao_manager.jwt_manager'
