# 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:
# define databse connection here if the api is deployed to external servers

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: true

    # 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\EventListener\AnnotationListener:
        tags:
            - { name: kernel.event_listener, event: kernel.controller, method: onKernelController }

    App\EventSubscriber\RequestSubscriber:
        tags:
            - { name: kernel.event_listener, event: kernel.controller }

    App\EventSubscriber\ResponseSubscriber:
        tags:
            - { name: kernel.event_listener, event: kernel.response }

    App\EventSubscriber\ExceptionSubscriber:
        tags:
            - { name: kernel.event_listener, event: kernel.exception }

    App\EventListener\BookingDatabaseListener:
        tags:
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postPersist'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500

            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postRemove'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postUpdate'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postLoad'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'prePersist'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'preUpdate'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postFlush'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'onFlush'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500

    App\EventListener\CustomerCreateListener:
        tags:
            -   name: 'doctrine.orm.entity_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'prePersist'
                entity: 'App\Entity\Customer'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postFlush'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            -   name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'onFlush'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500
            - name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
              event: 'postLoad'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
              priority: 500

    App\EventListener\InvoicePositionDatabaseListener:
        tags:
            -   name: 'doctrine.orm.entity_listener'
                # this is the only required option for the lifecycle listener tag
                event: 'postLoad'
                entity: 'App\Entity\InvoicePosition'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
                priority: 500

    App\EventListener\InputFieldDatabaseListener:
        tags:
            - name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
              event: 'postLoad'
              entity: 'App\Entity\InputField'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
              priority: 500

    App\EventListener\GroupDatabaseListener:
        tags:
            - name: 'doctrine.event_listener'
                # this is the only required option for the lifecycle listener tag
              event: 'postLoad'
              entity: 'App\Entity\Group'
                # listeners can define their priority in case multiple listeners are associated
                # to the same event (default priority = 0; higher numbers = listener is run earlier)
              priority: 500

    App\DBAL\ConnectionWrapper: '@doctrine.dbal.default_connection'

    app.event.jwt_created_listener:
        class: App\EventListener\JWTCreatedListener
        arguments: [ '@request_stack' ]
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_created, method: onJWTCreated }
