services:
    _defaults:
        autoconfigure: true

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

    contao_news.controller.page.news_feed:
        class: Contao\NewsBundle\Controller\Page\NewsFeedController
        arguments:
            - '@contao.assets.files_context'
            - '@contao_news.feed_specification'
            - '%kernel.charset%'
            - '%kernel.debug%'

    contao_news.feed_specification:
        class: FeedIo\Specification
        arguments:
            - '@logger'

    contao_news.insert_tag.news:
        class: Contao\NewsBundle\InsertTag\NewsInsertTag
        arguments:
            - '@contao.framework'
            - '@contao.routing.content_url_generator'

    contao_news.listener.data_container.layout_feed_options:
        class: Contao\NewsBundle\EventListener\DataContainer\LayoutFeedOptionsListener
        arguments:
            - '@contao.framework'
            - '@translator'

    contao_news.listener.data_container.news_search:
        class: Contao\NewsBundle\EventListener\DataContainer\NewsSearchListener
        arguments:
            - '@contao.framework'
            - '@database_connection'
            - '@contao.routing.content_url_generator'

    contao_news.listener.data_container.page:
        class: Contao\NewsBundle\EventListener\DataContainer\PageListener
        arguments:
            - '@database_connection'
            - '@security.authorization_checker'

    contao_news.listener.data_container.start_stop_validation:
        class: Contao\CoreBundle\EventListener\DataContainer\StartStopValidationListener
        arguments:
            - '@translator'
        tags:
            - { name: contao.callback, table: tl_news, target: config.onbeforesubmit }

    contao_news.listener.generate_page:
        class: Contao\NewsBundle\EventListener\GeneratePageListener
        arguments:
            - '@contao.framework'
            - '@contao.routing.content_url_generator'

    contao_news.listener.news_feed:
        class: Contao\NewsBundle\EventListener\NewsFeedListener
        arguments:
            - '@contao.framework'
            - '@contao.image.factory'
            - '@contao.routing.content_url_generator'
            - '@contao.insert_tag.parser'
            - '%kernel.project_dir%'
            - '@contao.cache.tag_manager'
            - '%kernel.charset%'
            - '@security.helper'

    contao_news.listener.preview_url_convert:
        class: Contao\NewsBundle\EventListener\PreviewUrlConvertListener
        arguments:
            - '@contao.framework'
            - '@contao.routing.content_url_generator'

    contao_news.listener.preview_url_create:
        class: Contao\NewsBundle\EventListener\PreviewUrlCreateListener
        arguments:
            - '@contao.framework'
            - '@contao.data_container.dca_url_analyzer'
            - '@database_connection'

    contao_news.listener.sitemap:
        class: Contao\NewsBundle\EventListener\SitemapListener
        arguments:
            - '@contao.framework'
            - '@security.helper'
            - '@contao.routing.content_url_generator'

    contao_news.migration.feed:
        class: Contao\NewsBundle\Migration\FeedMigration
        arguments:
            - '@database_connection'
            - '@filesystem'
            - '%contao.web_dir%'

    contao_news.migration.overwrite_meta:
        class: Contao\NewsBundle\Migration\OverwriteMetaMigration
        arguments:
            - '@database_connection'

    contao_news.picker.news_provider:
        class: Contao\NewsBundle\Picker\NewsPickerProvider
        arguments:
            - '@knp_menu.factory'
            - '@router'
            - '@?translator'
            - '@security.helper'

    contao_news.routing.news_resolver:
        class: Contao\NewsBundle\Routing\NewsResolver
        arguments:
            - '@contao.framework'

    contao_news.security.news_access_voter:
        class: Contao\NewsBundle\Security\Voter\NewsAccessVoter
        arguments:
            - '@security.access.decision_manager'

    contao_news.security.news_archive_access_voter:
        class: Contao\NewsBundle\Security\Voter\NewsArchiveAccessVoter
        arguments:
            - '@security.access.decision_manager'

    contao_news.security.news_content_voter:
        class: Contao\NewsBundle\Security\Voter\NewsContentVoter
        arguments:
            - '@security.access.decision_manager'
            - '@database_connection'
