services:
    _defaults:
        autoconfigure: true

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

    contao_calendar.cron.generate_feeds:
        class: Contao\CalendarBundle\Cron\GenerateFeedsCron
        arguments:
            - '@contao.framework'

    contao_calendar.insert_tag.event:
        class: Contao\CalendarBundle\InsertTag\EventInsertTag
        arguments:
            - '@contao.framework'
            - '@contao.routing.content_url_generator'

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

    contao_calendar.listener.generate_page:
        class: Contao\CalendarBundle\EventListener\GeneratePageListener
        arguments:
            - '@contao.framework'

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

    contao_calendar.listener.preview_url_create:
        class: Contao\CalendarBundle\EventListener\PreviewUrlCreateListener
        arguments:
            - '@request_stack'
            - '@contao.framework'

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

    contao_calendar.picker.event_provider:
        class: Contao\CalendarBundle\Picker\EventPickerProvider
        arguments:
            - '@knp_menu.factory'
            - '@router'
            - '@?translator'
            - '@security.helper'

    contao_calendar.routing.calendar_events_resolver:
        class: Contao\CalendarBundle\Routing\CalendarEventsResolver
        arguments:
            - '@contao.framework'

    contao_calendar.security.calendar_access_voter:
        class: Contao\CalendarBundle\Security\Voter\CalendarAccessVoter
        arguments:
            - '@security.access.decision_manager'

    contao_calendar.security.calendar_content_voter:
        class: Contao\CalendarBundle\Security\Voter\CalendarContentVoter
        arguments:
            - '@security.access.decision_manager'
            - '@database_connection'

    contao_calendar.security.calendar_events_access_voter:
        class: Contao\CalendarBundle\Security\Voter\CalendarEventsAccessVoter
        arguments:
            - '@security.access.decision_manager'
