# 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.html#use-parameters-for-application-configuration
parameters:
    public_directory: '%kernel.project_dir%/public'
    uploads_avatar_directory: '%public_directory%/medias'
    app.path.user_images: /medias/avatars
    app.path.event_images: /medias/ateliers
    app.path.thumbmail_images: /medias/miniatures
    app.path.announce_medias: /medias/annonces
    app.path.cba_video: /medias/videos
    app.path.cba_replay: /medias/replay
    app.path.cba_pdf: /medias/pdfs
    app.path.cba_audio: /medias/audios


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.

        bind:               # makes $publicPath available to all services
            $publicPath: '%public_directory%'
            string $uploadImageAvatar: '%app.path.user_images%'
            string $uploadImageEvent: '%app.path.event_images%'
            string $uploadThumbmail: '%app.path.thumbmail_images%'
            string $uploadMediaAnnounce: '%app.path.announce_medias%'
            #string $uploadCbaVideo: '%app.path.cba_video%'
            #string $uploadCbaReplay: '%app.path.cba_replay%'
            #string $uploadCbaPdf: '%app.path.cba_pdf%'
            #string $uploadCbaAudio: '%app.path.cba_audio%'


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

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones
    App\Controller\:
        resource: '../src/Controller/*'
        tags: ['controller.service_arguments']

    
    # makes classes in uploadAvatarPath available to be used as services
    App\Service\FileUploader:
        arguments:
            $uploadPath: '%uploads_avatar_directory%'

    
    cba_api.event.authentication_success_listener:
        class: App\EventListener\JWTCreatedListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_created, method: onJWTCreated }

    
    App\EventListener\EventWaitingList:
        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

                # you can also restrict listeners to a specific Doctrine connection
                connection: 'default'

    
    App\EventListener\EventsListener:
        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

                # you can also restrict listeners to a specific Doctrine connection
                connection: 'default'
                

    App\EventListener\CommentsListener:
        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

                # you can also restrict listeners to a specific Doctrine connection
                connection: 'default'


    
    App\EventListener\BabiesListener:
        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

                # you can also restrict listeners to a specific Doctrine connection
                connection: 'default'


    App\Service\PaypalService:
        arguments:
            $client: '@http_client'
            # $clientId: '%env(PAYPAL_CLIENT_ID)%'
            # $clientSecret: '%env(PAYPAL_CLIENT_SECRET)%'
            # $mode: '%env(PAYPAL_MODE)%'