# 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.locales: ['fr', 'en', 'nl', 'de']
    app.default_locale: 'fr'
    app.email_sender: '%env(APP_EMAIL)%'
    app.domain: '%env(APP_DOMAIN)%'
    app.sender_name: 'Administrateur Serveur Dmqode.be'
    app.logo_directory: '%kernel.project_dir%/public/images'

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'

    # add more service definitions when explicit configuration is needed
    
    # Service email verifier for registration
    App\Security\EmailVerifier:
        arguments:
            $helper: '@SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface'
            $mailer: '@mailer.mailer'
            $manager: '@doctrine.orm.entity_manager'
    
    # Service for email templates management
    App\Service\EmailTemplateService:
        arguments:
            $templateRepository: '@App\Repository\EmailTemplateRepository'
            $translator: '@translator'
            $defaultLocale: '%app.default_locale%'
            $emailSender: '%app.email_sender%'
            $domain: '%app.domain%'
            $senderName: '%app.sender_name%'
            
    # Service for admin permissions management
    App\Service\AdminPermissionService:
        arguments:
            $permissionRepository: '@App\Repository\AdminPermissionRepository'
    
    # Service for dynamic translations
    App\Service\DynamicTranslatorService:
        arguments:
            $defaultLocale: '%app.default_locale%'
    
    # Service for static translations management
    App\Service\StaticTranslationService:
        arguments:
            $projectDir: '%kernel.project_dir%'
            $availableLocales: '%app.locales%'
    
    # Locale listeners and subscribers
    App\EventListener\UserLocaleListener:
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin }
    
    App\EventListener\LocaleListener:
        arguments:
            $requestStack: '@request_stack'
            $tokenStorage: '@security.token_storage'
    
    App\EventSubscriber\LocaleSubscriber:
        arguments:
            $defaultLocale: '%app.default_locale%'
    
    # Locale Controller
    App\Controller\LocaleController:
    
    # Async email message handler
    App\MessageHandler\SendEmailMessageHandler:
        tags: ['messenger.message_handler']