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

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.

    # 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/'
            - '../src/Entity/'
            - '../src/Kernel.php'
            - '../src/Tests/'

    # 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\OpenApi\JwtDecorator:
        decorates: 'api_platform.openapi.factory'
        autoconfigure: false

    App\DataPersister\VehiculeDataPersister:
        tags: [ 'api_platform.data_persister' ]
        
    App\DataPersister\UserDataPersister:
        decorates: 'api_platform.doctrine.orm.data_persister'
        
    monimmat_api.event.jwt_created_listener:
        class: App\EventListener\JWTCreatedListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_created, method: onJWTCreated }

    monimmat_api.event.authentication_success_listener:
        class: App\EventListener\AuthenticationSuccessListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_authentication_success, priority: -1, method: onAuthenticationSuccessResponse }

    monimmat.events.exeception_subscriber:
        class: App\Events\ExceptionSubscriber
        arguments:
            - '@serializer'
        tags:
            - { name: kernel.event_subscriber }

    monimmat.normalizer.resource_access_exception:
        class: App\Normalizer\ResourceAccessExceptionNormalizer
        arguments:
            - { type: 'App\Exceptions\ResourceAccessException' }
        tags:
            - { name: 'monimmat.normalizer'}

    monimmat.normalizer.authentification_exception:
        class: App\Normalizer\AuthentificationExceptionNormalizer
        arguments:
            - { type: 'App\Exceptions\AuthentificationException' }
        tags:
            - { name: 'monimmat.normalizer'}

    monimmat.normalizer.authentificationnot_found_exception:
        class: App\Normalizer\NotFoundExceptionNormalizer
        arguments:
            - { type: 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' }
        tags:
            - { name: 'monimmat.normalizer'}

    monimmat.services.fabdata_api:
        class: App\Services\FabdataApiInterface
