# 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.password.reset.url.ps: '%env(PASSWORD_RESET_URL_PS)%'
    app.password.reset.url.pt: '%env(PASSWORD_RESET_URL_PT)%'
    app.pdfUrl: '%env(PDF_URL)%'
    app.xmlUrl: '%env(XML_URL)%'
    app.sinchNumber: '%env(SINCH_NUMBER)%'
    app.servicePlanId: '%env(SERVICE_PLAN_ID)%'
    app.region: '%env(REGION)%'
    app.bearerToken: '%env(BEARER_TOKEN)%'
    app.emailFrom: '%env(EMAIL_FROM)%'
    app.annuairePS: '%env(ANNUAIRE_PS_SITE_URL)%'
    serverHl7Url: '%env(SERVER_HL7_SITE_URL)%'
    ldlThresholdVal: 1.2
    app.careGiverPassword: 'Digicap2025+'
    app.bmiIdealMinVal: 18
    app.bmiIdealMaxVal: 25
    twilio.account_sid: '%env(TWILIO_ACCOUNT_SID)%'
    twilio.auth_token: '%env(TWILIO_AUTH_TOKEN)%'
    twilio.from: '%env(TWILIO_FROM)%'

    id.patient.test: 8
    otp.patient.test: '1234'
    
    # classe therapeutiques: liste des classes thérapeutiques gérées dans l'application
    app.hypolipidemics:
        - Hypolipémiants - Autres
        - Hypolipémiants - Statines
    app.antithrombotics:
        - Anticoagulants injectables
        - Anticoagulants oraux - AOD
        - Antiplaquettaires

    # Variables de processus de l'OTP
    otp.expiration: 240       
    otp.max.incorrect.attempts: 5 
    otp.max.resend.attempts: 3
    otp.min.resend.delay.seconds: 60

    # Paramètres d'inactivité fonction rénale
    inactivity.renal.function.months: 12
    # Variables de processus de mot de passe erronés
    blocage.duration.in.days: 15
    password.blocking.attempts: 5

    # Token Expiration en secondes
    token.expiration: 14400 # 4 heures

    # durée d'expiration du token de réinitialisation du mot de passe en minutes
    reset.password.expiration.duration: 120

    # Exponent host for mobile push notifications
    exponent.host: '%env(EXPONENT_HOST)%'

    #LINKS
    healthcare.link: '%env(HEALTHCARE_SUPPORT_LINK)%'
    destiva.ptLink: '%env(DESTIVA_PT_LINK)%'
    destiva.psLink: '%env(DESTIVA_PS_LINK)%'

    filter.structure.config: '%kernel.project_dir%/config/FilterStructure.json'
    app.encryption_key: '%env(ENCRYPTION_KEY)%'
    app.encryption_iv: '%env(ENCRYPTION_IV)%'

imports:
    - { resource: parameters/global_variables.yaml }
    - { resource: app_params.yml }

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'

    # Abonne l'écouteur PersistUpdateListener aux événements Doctrine.
    App\Listener\PersistUpdateListener:
        tags:
            - { name: 'doctrine.event_subscriber' }

    App\Controller\Patient\PatientController:
        arguments:
            $em: '@doctrine.orm.entity_manager'
            $globalService: '@App\Service\GlobalService'
            $ppcpService: '@App\Service\PpcpService'
            $security: '@security.helper'
            $emailService: '@App\Service\EmailsTemplateSenderService'

    # Enregistrement de l'écouteur HistoricListener pour différents événements Doctrine.
    App\Listener\HistoricListener:
        tags:
            - { name: doctrine.event_subscriber, event: postPersist } # Après la création d'une entité
            - { name: doctrine.event_subscriber, event: postUpdate }  # Après la mise à jour d'une entité
            - { name: doctrine.event_subscriber, event: preRemove }   # Avant la suppression d'une entité

    # Activation de l'autowiring pour le repository HistoricRepository.
    App\Repository\HistoricRepository:
        autowire: true # Permet à Symfony d'injecter automatiquement les dépendances

    App\Listener\TokenListener:
        tags:
            - { name: kernel.event_listener, event: kernel.controller, method: onKernelcontroller}

     # Enregistrement log utilisateur.
    App\Service\SystemHistoryLogger:
      arguments:
        $systemHistoryLogger: '@monolog.logger.system_history'

    # Service Captcha
    App\Service\TurnstileVerifier:
        arguments:
            $secretKey: '%env(TURNSTILE_SECRET_KEY)%' 