# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# 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: 'es'
    app_locales: en|fr|de|es|cs|nl|ru|uk|ro|pt_BR|pl|it|ja|id|ca|sl|hr|zh_CN
    app.notifications.email_sender: anonymous@example.com
    
services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
        public: false
        
    # 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/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'

    # controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
        resource: '../src/Controller'
        tags: ['controller.service_arguments']

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones
    
    App\Twig\FormExtension:
        arguments: ['@twig.form.renderer']
        tags: ['twig.extension']
                        
    select2.autocomplete:
        class: Tetranz\Select2EntityBundle\Service\AutocompleteService
        public: true

    Tetranz\Select2EntityBundle\Service\AutocompleteService: '@select2.autocomplete'

    select2.autocomplete_helper:
        class: App\Service\AutocompleteHelper
        public: true

    convenio_listener:
        class: App\Listener\ConvenioListener
        tags:                        
            -
                name: doctrine.orm.entity_listener
                event: postPersist
                entity: App\Entity\Convenio
            -
                name: doctrine.orm.entity_listener
                event: postUpdate
                entity: App\Entity\Convenio
                
    pacto_listener:
        class: App\Listener\PactoListener
        tags:                                    
            -
                name: doctrine.orm.entity_listener
                event: preUpdate
                entity: App\Entity\PactoCuotaLitis
    caja_movimiento_listener:
        class: App\Listener\CajaMovimientoListener
        tags:                                    
            -
                name: doctrine.orm.entity_listener
                event: prePersist
                entity: App\Entity\CajaMovimiento
            - { name: doctrine.orm.entity_listener, event: preUpdate, entity: App\Entity\CajaMovimiento }
                
#    cobro_caso_listener:
#        class: App\Listener\CobroCasoListener
#        tags:                        
#            -
#                name: doctrine.orm.entity_listener
#                event: postUpdate
#                entity: App\Entity\CobroCaso           
    caso_listener:
        class: App\Listener\CasoListener
        tags:                        
            -
                name: doctrine.orm.entity_listener
                event: postUpdate
                entity: App\Entity\Caso           
            -
                name: doctrine.orm.entity_listener
                event: postPersist
                entity: App\Entity\Caso               
       
    login_listener:
        class:  App\Listener\LoginListener
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method: onSecurityInteractiveLogin }  
    before_request_listener:
        class: App\Listener\BeforeRequestListener
        arguments: ["@doctrine.orm.entity_manager"]
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
    
    my.directory_namer.sucursal:
        class: App\Service\DirectoryNamerSucursal
        public: true
    
    App\Listener\CasoNumeroListener:
      tags:
      -
        name: 'doctrine.orm.entity_listener'
        event: 'prePersist'
        entity: 'App\Entity\Caso'
        lazy: true  
                
    sucursal_listener:
        class: App\Listener\SucursalListener
        tags:
          -
            name: doctrine.orm.entity_listener
            event: prePersist                
            lazy: true               
            
    App\Form\Extension\UserPermisosTypeExtension:
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType }

    etapas_service:
        class: App\Utils\Etapas
        arguments: [ "@doctrine.orm.entity_manager" ]