# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: '%env(LANGUAGE)%'
    version: '2.0.9'
    title: 'Novo SGA CE'

services:
    # default configuration for services in *this* file
    _defaults:
        # Automatically injects dependencies in your services.
        autowire: true
        # Automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
        # Allows optimizing the container by removing unused services; this also means
        # fetching services directly from the container via $container->get() won't work.
        # The best practice is to be explicit about your dependencies anyway.
        public: false
        bind:
            $rootDir: '%kernel.project_dir%'

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/*'
        exclude: '../src/{Entity,Migrations,Tests}'
        
    # controllers are imported separately to make sure they
    # have the tag that allows actions to type-hint services
    App\Controller\:
        resource: '../src/Controller'
        tags: ['controller.service_arguments']
        
    App\Listener\SessionListener:
        tags:
            - { name: kernel.event_listener, event: kernel.request, priority: 6 }
        
    App\Listener\AccessListener:
        tags:
            - { name: kernel.event_listener, event: kernel.request, priority: 7 }

    App\Listener\CorsListener:
        tags:
            - { name: kernel.event_listener, event: kernel.request, priority: 700 }

    App\Listener\JsonExceptionListener:
        tags:
            - { name: kernel.event_listener, event: kernel.exception, priority: 1000 }

    App\Listener\ORM\DoctrineListener:
        tags:
            - { name: doctrine.event_subscriber }

    App\Service\TicketService:
        public: true

    App\Loader\RouterLoader:
        tags:
            - { name: routing.loader }

    App\Extensions\Doctrine\TablePrefix:
        arguments: [""]
        tags:
            - { name: doctrine.event_listener, event: loadClassMetadata, connection: default }

    App\Extensions\Doctrine\SchemaViewIgnorer:
        tags:
            - { name: doctrine.event_listener, event: postGenerateSchema, connection: default }
    
    # novosga core services
    Novosga\Service\:
        resource: '../vendor/novosga/core/Service'
        public: true
        
    Novosga\Event\EventDispatcherInterface: '@App\Service\EventDispatcher'
        
    Novosga\Infrastructure\StorageInterface:
        factory: 'App\Infrastructure\StorageFactory:createStorage'

    Novosga\Service\Configuration:
        $rootDir: '%kernel.project_dir%'
