services:
    _defaults:
        autoconfigure: true

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

        Contao\CoreBundle\Twig\Studio\Operation\AbstractOperation:
            tags:
                - { name: container.service_subscriber, id: contao.twig.studio.cache_invalidator }

    Contao\CoreBundle\Controller\BackendTemplateStudioController:
        arguments:
            - '@contao.twig.filesystem_loader'
            - '@contao.twig.finder_factory'
            - '@contao.twig.inspector'
            - '@contao.twig.loader.theme_namespace'
            - '@contao.twig.studio.operation_context_factory'
            - '@contao.twig.studio.autocomplete'
            - '@database_connection'
            - !tagged_iterator { tag: contao.operation.template_studio_element, index_by: name }

    contao.twig.studio.autocomplete:
        class: Contao\CoreBundle\Twig\Studio\Autocomplete
        arguments:
            - '@contao.twig.inspector'
            - '@contao.twig.finder_factory'
            - '@twig'

    contao.twig.studio.cache_invalidator:
        class: Contao\CoreBundle\Twig\Studio\CacheInvalidator
        arguments:
            - '@twig'
            - '@contao.twig.filesystem_loader'

    contao.twig.studio.create_content_element_variant_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\CreateContentElementVariantOperation

    contao.twig.studio.create_frontend_module_variant_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\CreateFrontendModuleVariantOperation

    contao.twig.studio.create_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\CreateOperation

    contao.twig.studio.create_page_variant_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\CreatePageVariantOperation

    contao.twig.studio.delete_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\DeleteOperation

    contao.twig.studio.operation_context_factory:
        class: Contao\CoreBundle\Twig\Studio\Operation\OperationContextFactory
        arguments:
            - '@contao.twig.loader.theme_namespace'

    contao.twig.studio.rename_content_element_variant_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\RenameContentElementVariantOperation

    contao.twig.studio.rename_frontend_module_variant_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\RenameFrontendModuleVariantOperation

    contao.twig.studio.rename_page_variant_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\RenamePageVariantOperation

    contao.twig.studio.save_operation:
        class: Contao\CoreBundle\Twig\Studio\Operation\SaveOperation
        arguments:
            - '@contao.twig.inspector'

    contao.twig.studio.template_skeleton_factory:
        class: Contao\CoreBundle\Twig\Studio\TemplateSkeletonFactory
        arguments:
            - '@twig'
            - '@contao.twig.inspector'

    # Autowiring aliases
    Contao\CoreBundle\Twig\Studio\TemplateSkeletonFactory: '@contao.twig.studio.template_skeleton_factory'
