services:
    _defaults:
        autoconfigure: true

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

        Contao\CoreBundle\Controller\AbstractController:
            tags:
                - { name: container.service_subscriber, id: contao.csrf.token_manager }

    # We explicitly allow autowiring and FQCN service IDs in controllers
    Contao\CoreBundle\Controller\BackendController: ~

    Contao\CoreBundle\Controller\BackendCsvImportController:
        public: true
        arguments:
            - '@contao.framework'
            - '@database_connection'
            - '@request_stack'
            - '@translator'
            - '%kernel.project_dir%'

    Contao\CoreBundle\Controller\BackendPreviewController:
        arguments:
            - '%contao.preview_script%'
            - '@contao.security.frontend_preview_authenticator'
            - '@event_dispatcher'
            - '@security.authorization_checker'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\BackendPreviewSwitchController:
        arguments:
            - '@contao.security.frontend_preview_authenticator'
            - '@contao.security.token_checker'
            - '@database_connection'
            - '@security.helper'
            - '@twig'
            - '@router'
            - '@contao.csrf.token_manager'
            - '@translator'
            - '%contao.backend.attributes%'
            - '%contao.backend.badge_title%'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\CaptchaController:
        arguments:
            - '@contao.framework'
            - '%kernel.project_dir%'
            - '@contao.cache.entity_tags'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\ContentElement\MarkdownController:
        tags:
            - { name: contao.content_element, category: texts }

    Contao\CoreBundle\Controller\ContentElement\TemplateController:
        tags:
            - { name: contao.content_element, category: includes }

    Contao\CoreBundle\Controller\FaviconController:
        arguments:
            - '@contao.framework'
            - '%kernel.project_dir%'
            - '@contao.cache.entity_tags'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\FrontendController:
        tags:
            - controller.service_arguments
            - { name: container.service_subscriber, id: contao.cron }
            - { name: container.service_subscriber, id: contao.csrf.token_manager }

    Contao\CoreBundle\Controller\FrontendModule\RootPageDependentModulesController:
        tags:
            - { name: contao.frontend_module, category: miscellaneous }

    Contao\CoreBundle\Controller\FrontendModule\TemplateController:
        tags:
            - { name: contao.frontend_module, category: miscellaneous }

    Contao\CoreBundle\Controller\FrontendModule\TwoFactorController:
        tags:
            - { name: contao.frontend_module, category: user }

    Contao\CoreBundle\Controller\ImagesController:
        public: true
        arguments:
            - '@contao.image.factory'
            - '@contao.image.legacy_resizer'
            - '%contao.image.target_dir%'
            - '@?filesystem'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\InitializeController:
        arguments:
            - '@contao.framework'
            - '@request_stack'
            - '@event_dispatcher'
            - '@http_kernel'
            - '@kernel'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\InsertTagsController:
        arguments:
            - '@contao.insert_tag.parser'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\Page\ErrorPageController:
        arguments:
            - '@contao.framework'

    Contao\CoreBundle\Controller\Page\RootPageController:
        arguments:
            - '@?logger'
        tags:
            - { name: monolog.logger, channel: contao.error }

    Contao\CoreBundle\Controller\PreviewLinkController:
        arguments:
            - '@contao.security.frontend_preview_authenticator'
            - '@uri_signer'
            - '@database_connection'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\RobotsTxtController:
        arguments:
            - '@contao.framework'
            - '@event_dispatcher'
        tags:
            - controller.service_arguments

    Contao\CoreBundle\Controller\SitemapController:
        arguments:
            - '@contao.routing.page_registry'
        tags:
            - controller.service_arguments

    # Backwards compatibility
    contao.controller.backend_csv_import:
        alias: Contao\CoreBundle\Controller\BackendCsvImportController
        public: true
        deprecated:
            package: contao/core-bundle
            version: 4.9
            message: Using the "%alias_id%" service ID has been deprecated and will no longer work in Contao 5.0. Please use "Contao\CoreBundle\Controller\BackendCsvImportController" instead.

    contao.controller.images:
        alias: Contao\CoreBundle\Controller\ImagesController
        public: true
        deprecated:
            package: contao/core-bundle
            version: 4.9
            message: Using the "%alias_id%" service ID has been deprecated and will no longer work in Contao 5.0. Please use "Contao\CoreBundle\Controller\ImagesController" instead.

    contao.controller.insert_tags:
        alias: Contao\CoreBundle\Controller\InsertTagsController
        public: true
        deprecated:
            package: contao/core-bundle
            version: 4.9
            message: Using the "%alias_id%" service ID has been deprecated and will no longer work in Contao 5.0. Please use "Contao\CoreBundle\Controller\InsertTagsController" instead.
