# 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:
    app.url: '%env(APP_URL)%' # The base URL of your application, used in OpenAPI documentation
    app.jwt_token_ttl: '%env(int:JWT_TOKEN_TTL)%' # The time-to-live for JWT tokens in seconds
    app.default.password: '%env(APP_DEFAULT_PASSWORD)%' # Default password for user accounts

    app.institution_id_header: 'X-Institution-ID' # Header name for institution ID
    app.institution_required_paths:
        - '^/api/students'
        - '^/api/teachers'
        - '^/api/courses'
        - '^/api/tuition-payments'
        - '^/api/payments'
        - '^/api/notes'
        - '^/api/examens'
        - '^/api/exercices'
        - '^/api/therapeutic-follow-ups'
        - '^/api/student-submissions'
        

services:
    App\EventListener\InstitutionContextListener:
        tags:
            - { name: 'kernel.event_listener', event: 'kernel.request', method: 'onKernelRequest' }
        arguments:
            $institutionRepository: '@App\Repository\Institution\InstitutionRepository'
            $institutionContext: '@App\Security\Context\InstitutionContext'
            $security: '@security.helper'

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

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones

    App\Security\Context\InstitutionContext:
        shared: true

    App\Encoder\MultipartDecoder:
        arguments:
            $requestStack: '@request_stack'
        tags: [ 'serializer.encoder' ]

    App\ApiPlatform\Extension\SoftDeleteCourseExtension:
        tags: ['api_platform.doctrine.orm.query_extension.collection', 'api_platform.doctrine.orm.query_extension.item']

    App\ApiPlatform\Extension\SoftDeleteLevelExtension:
        tags: ['api_platform.doctrine.orm.query_extension.collection', 'api_platform.doctrine.orm.query_extension.item']

    