# 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.base_url: '%env(APP_BASE_URL)%'
    # Par défaut, l'enveloppe From reprend le compte authentifié du DSN SMTP.
    # L'adresse de la société reste utilisée comme Reply-To dans EmailBundle.
    app.email_default_from: '%env(key:user:url:MAILER_DSN)%'
    app.email_attachments_dir: '%kernel.project_dir%/var/email_attachments'
    app.organization_logo_dir: '%kernel.project_dir%/public/uploads/organizations'
    app.organization_logo_max_size: '2048k'
    app.project_logo_dir: '%kernel.project_dir%/public/uploads/projects'
    app.project_logo_max_size: '4096k'
    app.partner_logo_dir: '%kernel.project_dir%/public/uploads/partners'
    app.benefit_image_dir: '%kernel.project_dir%/public/uploads/benefits'
    app.storage_dir: '%kernel.project_dir%/var/app'
    app.contract_storage_dir: '%kernel.project_dir%/var/storage/contracts'
    app.signature_storage_dir: '%kernel.project_dir%/var/storage/signatures'
    app.generated_document_storage_dir: '%kernel.project_dir%/var/storage/generated_documents'
    app.leave_storage_dir: '%kernel.project_dir%/var/storage/leaves'
    app.interview_storage_dir: '%kernel.project_dir%/var/storage/interviews'
    app.signature_certificate_storage_dir: '%kernel.project_dir%/var/storage/signature_certificates'
    app.version: 'dev'
    app.error_support_email: 'support@app.local'
    app.error_mail_from: '%app.email_default_from%'
    app.error_not_found_route: 'app_error_404'
    app.error_notifications_enabled: true
    app.error_notifications_in_dev: false

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/Bundles/'
            - '../src/Kernel.php'

    App\Bundle\AppBundle\Repository\:
        resource: '../src/Bundles/AppBundle/Repository/'

    App\Bundle\AdminBundle\Repository\:
        resource: '../src/Bundles/AdminBundle/Repository/'

    App\Bundle\EmployeeBundle\Repository\:
        resource: '../src/Bundles/EmployeeBundle/Repository/'

    App\Bundle\EmployeeBundle\:
        resource: '../src/Bundles/EmployeeBundle/'
        exclude:
            - '../src/Bundles/EmployeeBundle/Entity/'
            - '../src/Bundles/EmployeeBundle/Repository/'

    App\Bundle\ContractBundle\Repository\:
        resource: '../src/Bundles/ContractBundle/Repository/'

    App\Bundle\ContractBundle\:
        resource: '../src/Bundles/ContractBundle/'
        exclude:
            - '../src/Bundles/ContractBundle/Entity/'
            - '../src/Bundles/ContractBundle/Repository/'

    App\Bundle\DocumentTemplateBundle\Repository\:
        resource: '../src/Bundles/DocumentTemplateBundle/Repository/'

    App\Bundle\DocumentTemplateBundle\:
        resource: '../src/Bundles/DocumentTemplateBundle/'
        exclude:
            - '../src/Bundles/DocumentTemplateBundle/Entity/'
            - '../src/Bundles/DocumentTemplateBundle/Repository/'

    App\Bundle\SignatureBundle\Repository\:
        resource: '../src/Bundles/SignatureBundle/Repository/'

    App\Bundle\SignatureBundle\:
        resource: '../src/Bundles/SignatureBundle/'
        exclude:
            - '../src/Bundles/SignatureBundle/Entity/'
            - '../src/Bundles/SignatureBundle/Repository/'

    App\Bundle\LeaveBundle\Repository\:
        resource: '../src/Bundles/LeaveBundle/Repository/'

    App\Bundle\LeaveBundle\:
        resource: '../src/Bundles/LeaveBundle/'
        exclude:
            - '../src/Bundles/LeaveBundle/Entity/'
            - '../src/Bundles/LeaveBundle/Repository/'
            - '../src/Bundles/LeaveBundle/Form/'

    App\Bundle\PlanningBundle\Repository\:
        resource: '../src/Bundles/PlanningBundle/Repository/'

    App\Bundle\PlanningBundle\:
        resource: '../src/Bundles/PlanningBundle/'
        exclude:
            - '../src/Bundles/PlanningBundle/Entity/'
            - '../src/Bundles/PlanningBundle/Repository/'
            - '../src/Bundles/PlanningBundle/Form/'

    App\Bundle\TimeClockBundle\Repository\:
        resource: '../src/Bundles/TimeClockBundle/Repository/'

    App\Bundle\TimeClockBundle\:
        resource: '../src/Bundles/TimeClockBundle/'
        exclude:
            - '../src/Bundles/TimeClockBundle/Entity/'
            - '../src/Bundles/TimeClockBundle/Repository/'

    App\Bundle\InterviewBundle\Repository\:
        resource: '../src/Bundles/InterviewBundle/Repository/'

    App\Bundle\InterviewBundle\:
        resource: '../src/Bundles/InterviewBundle/'
        exclude:
            - '../src/Bundles/InterviewBundle/Entity/'
            - '../src/Bundles/InterviewBundle/Repository/'

    App\Bundle\MedicalVisitBundle\Repository\:
        resource: '../src/Bundles/MedicalVisitBundle/Repository/'

    App\Bundle\MedicalVisitBundle\:
        resource: '../src/Bundles/MedicalVisitBundle/'
        exclude:
            - '../src/Bundles/MedicalVisitBundle/Entity/'
            - '../src/Bundles/MedicalVisitBundle/Repository/'

    App\Bundle\SickLeaveBundle\Repository\:
        resource: '../src/Bundles/SickLeaveBundle/Repository/'

    App\Bundle\SickLeaveBundle\:
        resource: '../src/Bundles/SickLeaveBundle/'
        exclude:
            - '../src/Bundles/SickLeaveBundle/Entity/'
            - '../src/Bundles/SickLeaveBundle/Repository/'

    App\Bundle\EmailBundle\Repository\:
        resource: '../src/Bundles/EmailBundle/Repository/'

    App\Bundle\EmailBundle\:
        resource: '../src/Bundles/EmailBundle/'
        exclude:
            - '../src/Bundles/EmailBundle/DependencyInjection/'
            - '../src/Bundles/EmailBundle/Entity/'
            - '../src/Bundles/EmailBundle/Repository/'

    App\Bundle\AppBundle\Service\AppSettingsManager: ~
    App\Bundle\AppBundle\Service\InfoServices: ~
    App\Bundle\AppBundle\Service\NotificationService: ~
    App\Bundle\AppBundle\Service\NotificationRecipientResolver: ~
    App\Bundle\AppBundle\Service\NotificationRealtimePublisher: ~

    App\Bundle\AppBundle\Notification\:
        resource: '../src/Bundles/AppBundle/Notification/'

    App\Bundle\AppBundle\Service\Error\ErrorPayloadBuilder:
        arguments:
            $environment: '%kernel.environment%'

    App\Bundle\AppBundle\Service\Error\ErrorReportManager: ~

    App\Bundle\AppBundle\Service\Error\ErrorReportMailer:
        arguments:
            $supportEmail: '%app.error_support_email%'
            $fromEmail: '%app.error_mail_from%'

    App\Bundle\AppBundle\EventSubscriber\ExceptionSubscriber:
        arguments:
            $cache: '@cache.app'
            $environment: '%kernel.environment%'
            $notificationsEnabled: '%app.error_notifications_enabled%'
            $notifyInDev: '%app.error_notifications_in_dev%'
            $notFoundRoute: '%app.error_not_found_route%'

    App\Bundles\AppBundle\:
        resource: '../src/Bundles/AppBundle/'
        exclude:
            - '../src/Bundles/AppBundle/DependencyInjection/'
            - '../src/Bundles/AppBundle/Entity/'
            - '../src/Bundles/AppBundle/EventSubscriber/ExceptionSubscriber.php'
            - '../src/Bundles/AppBundle/Repository/'
            - '../src/Bundles/AppBundle/Notification/'
            - '../src/Bundles/AppBundle/Service/NotificationService.php'
            - '../src/Bundles/AppBundle/Service/NotificationRecipientResolver.php'
            - '../src/Bundles/AppBundle/Service/NotificationRealtimePublisher.php'

    App\Bundles\AppBundle\Controller\ErrorController:
        arguments:
            $supportEmail: '%app.error_support_email%'

    App\Bundles\AppBundle\Controller\Admin\ErrorReportController:
        arguments:
            $appVersion: '%app.version%'

    App\Bundles\AppBundle\Service\SireneService:
        arguments:
            $apiKey: '%env(INSEE_API_KEY)%'

    App\Bundles\AppBundle\Service\BrandfetchLogoService:
        arguments:
            $apiKey: '%env(BRANDFETCH_API_KEY)%'
            $apiBaseUrl: '%env(BRANDFETCH_API_BASE_URL)%'
            $storageDir: '%app.partner_logo_dir%/_brandfetch'
            $publicPrefix: '/uploads/partners/_brandfetch/'
            $allowedHostSuffixes: '%env(json:BRANDFETCH_ALLOWED_HOSTS)%'

    App\Bundles\AppBundle\Service\FileManagerService:
        arguments:
            $baseDir: '%app.storage_dir%'

    App\Bundle\ContractBundle\Service\ContractPdfGenerator:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Bundle\ContractBundle\Service\ContractCreationDocumentService:
        arguments:
            $contractStorageDir: '%app.contract_storage_dir%'

    App\Bundle\DocumentTemplateBundle\Service\DocumentStorageManager:
        arguments:
            $storageDir: '%app.generated_document_storage_dir%'

    App\Bundle\SignatureBundle\Service\SignatureImageManager:
        arguments:
            $signatureDir: '%app.signature_storage_dir%'

    App\Bundle\SignatureBundle\Service\SignatureDocumentSigner:
        arguments:
            $signatureDir: '%app.signature_storage_dir%'

    App\Bundle\SignatureBundle\Service\SignatureProofManager:
        arguments:
            $signatureDir: '%app.signature_storage_dir%'

    App\Bundle\SignatureBundle\Service\SignatureOtpManager:
        arguments:
            $otpPepper: '%kernel.secret%'
            $fromEmail: '%app.email_default_from%'

    App\Bundle\SignatureBundle\Service\SignatureCertificateGenerator:
        arguments:
            $certificateDir: '%app.signature_storage_dir%/certificates'

    App\Bundle\LeaveBundle\Service\LeaveManager:
        arguments:
            $leaveStorageDir: '%app.leave_storage_dir%'

    App\Bundle\InterviewBundle\Service\InterviewReportGenerator:
        arguments:
            $interviewStorageDir: '%app.interview_storage_dir%'
            $projectDir: '%kernel.project_dir%'

    App\Service\MenuBuilder:
        arguments:
            $projectDir: '%kernel.project_dir%'

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