imports:
    - { resource: services/controller.yml }
    - { resource: services/finder.yml }
    - { resource: services/manager.yml }
    - { resource: services/persistence.yml }
    - { resource: services/routing.yml }
    - { resource: services/voter.yml }

services:
    _defaults:
        autowire: false
        autoconfigure: false
        public: true

    Claroline\AppBundle\API\FinderProvider:
        arguments:
            - '@Claroline\AppBundle\Persistence\ObjectManager'
            - !tagged_iterator { tag: 'claroline.finder', default_index_method: 'getClass' }
            - '@Claroline\AppBundle\API\SerializerProvider'

    Claroline\AppBundle\API\Crud:
        arguments:
            - '@Claroline\AppBundle\Persistence\ObjectManager'
            - '@Claroline\AppBundle\Event\StrictDispatcher'
            - '@Claroline\AppBundle\API\FinderProvider'
            - '@Claroline\AppBundle\API\SerializerProvider'
            - '@Claroline\AppBundle\API\ValidatorProvider'
            - '@Claroline\AppBundle\API\SchemaProvider'
            - '@security.authorization_checker'

    Claroline\AppBundle\API\SchemaProvider:
        arguments:
            - '%kernel.project_dir%'
            - '@Claroline\AppBundle\API\SerializerProvider'

    Claroline\AppBundle\API\SerializerProvider:
        arguments:
            - '@Claroline\AppBundle\Persistence\ObjectManager'
            - !tagged_iterator claroline.serializer # Lazy collection of 'claroline.serializer' tagged services

    Claroline\AppBundle\API\ValidatorProvider:
        arguments:
            - '@Claroline\AppBundle\Persistence\ObjectManager'
            - !tagged_locator { tag: 'claroline.validator', default_index_method: 'getClass' }
            - '@Claroline\AppBundle\API\SchemaProvider'

    Claroline\AppBundle\Listener\ApiListener:
        arguments:
            - '@security.token_storage'
        tags:
            - { name: kernel.event_listener, event: kernel.exception, method: onError, priority: 99 }

    Claroline\AppBundle\Event\StrictDispatcher:
        arguments:
            - '@event_dispatcher'

    Claroline\AppBundle\Routing\ApiLoader:
        tags: ['routing.loader']
        arguments:
            - '@file_locator'
            - '@annotation_reader'
