# 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.version: '2.80.0'
    app.contact_email: '%env(CONTACT_EMAIL)%'

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

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

    # =========================================================================
    # SECURITY SERVICES
    # =========================================================================

    App\Service\Security\EncryptionService:
        arguments:
            $appSecret: '%env(APP_SECRET)%'

    # Campagne E2E du programme d'apport d'affaires : reçoit l'environnement courant
    # pour refuser de s'exécuter en production (elle crée et supprime des comptes).
    App\Command\Commercial\E2eCommercialCommand:
        arguments:
            $appEnv: '%kernel.environment%'

    App\Command\Payment\ReplayInvoiceCommand:
        arguments:
            $appEnv: '%kernel.environment%'

    App\Controller\StripeWebhookController:
        arguments:
            $stripeWebhookSecret: '%env(STRIPE_WEBHOOK_SECRET)%'

    App\Service\Payment\StripeClientInitializer:
        arguments:
            $stripeSecretKey: '%env(STRIPE_SECRET_KEY)%'

    # =========================================================================
    # SHARED SERVICES (utilisés par tous les produits)
    # =========================================================================

    # OpenAI HTTP Client centralisé (Moodia, Serenia, Slidia)
    App\Service\Shared\AI\OpenAIHttpClient:
        arguments:
            $apiKey: '%env(OPENAI_API_KEY)%'

    # =========================================================================
    # MOODIA SERVICES
    # =========================================================================

    # OpenAI Service Configuration (Moodia)
    App\Service\Moodia\OpenAIService:
        arguments:
            $apiKey: '%env(OPENAI_API_KEY)%'
            $model: '%env(OPENAI_MODEL)%'

    # Course Generation Service (Moodia - streaming)
    App\Service\Moodia\CourseGenerationService:
        arguments:
            $openaiApiKey: '%env(OPENAI_API_KEY)%'

    # Text-to-Speech Service (Moodia - audio generation via ElevenLabs)
    App\Service\Moodia\TextToSpeechService:
        arguments:
            $apiKey: '%env(ELEVENLABS_API_KEY)%'
            $projectDir: '%kernel.project_dir%'

    #  Service (podcast generation via ElevenLabs)
    App\Service\Castia\CastiaService:
        arguments:
            $projectDir: '%kernel.project_dir%'

    # Moodia Streaming Service (course generation)
    App\Service\Moodia\MoodiaStreamingService:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\Serenia\FileHandlerService:
        arguments:
            $publicDir: '%kernel.project_dir%/public'

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

    # MBZ Export Services
    App\Service\Moodia\Export\Builder\ArchiveBuilder:
        arguments:
            $cacheDir: '%kernel.cache_dir%'

    App\Service\Moodia\Export\Transformer\CourseTransformer:
        arguments:
            $projectDir: '%kernel.project_dir%'
            $cacheDir: '%kernel.cache_dir%'

    App\Service\Moodia\Export\Handler\Audio\AudioExportHandler:
        arguments:
            $projectDir: '%kernel.project_dir%'

    # Activity Generators (MBZ export) - tagged for auto-discovery
    App\Service\Moodia\Export\Generator\Activity\PageGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\QuizGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\ResourceGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\UrlGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\LabelGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\ForumGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\AssignmentGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Generator\Activity\ScormGenerator:
        tags: ['moodia.activity_generator']

    App\Service\Moodia\Export\Registry\ActivityGeneratorRegistry:
        arguments:
            $generators: !tagged_iterator moodia.activity_generator

    # Quiz — types de questions (auto-découverte via le tag moodia.question_type)
    App\Service\Moodia\Quiz\QuestionType\MultichoiceType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\TrueFalseType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\ShortAnswerType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\NumericalType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\MatchType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\GapSelectType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\DragDropTextType:
        tags: ['moodia.question_type']
    App\Service\Moodia\Quiz\QuestionType\CalculatedType:
        tags: ['moodia.question_type']

    App\Service\Moodia\Quiz\QuestionType\QuestionTypeRegistry:
        arguments:
            $types: !tagged_iterator moodia.question_type

    # =========================================================================
    # MOODIA CONTENT GENERATORS (generation pipeline)
    # =========================================================================
    # Tag: moodia.content_generator — auto-discovered by ActivityGeneratorRegistry
    # To add a new activity type: create a class implementing ActivityGeneratorInterface
    # and tag it here. Set available: true in MoodleActivityTypesConfig.

    App\Service\Moodia\Generation\Activity\Generator\PageActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\Generator\AudioActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\Generator\UrlActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\Generator\LabelActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\Generator\ForumActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\Generator\AssignmentActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\Generator\FileActivityGenerator:
        tags: ['moodia.content_generator']

    App\Service\Moodia\Generation\Activity\ActivityGeneratorRegistry:
        arguments:
            $generators: !tagged_iterator moodia.content_generator

    # =========================================================================
    # SCORMIA SERVICES
    # =========================================================================
    # Types de blocs (auto-découverte via le tag scormia.block_type)
    # Ajouter un type de bloc = créer la classe + la tagger ici + son rendu JS.

    App\Service\Scormia\Block\HeadingBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\SubtitleBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\RichTextBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\ImageBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\VideoBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\AudioBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\EmbedBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\ListBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\CalloutBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\QuoteBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\DividerBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\ButtonBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\StatsBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\TableBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\SpacerBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\CodeBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\FlashcardsBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\AccordionBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\TimelineBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\HotspotImageBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\DragDropBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\QuizBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\MatchBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\FillBlock:
        tags: ['scormia.block_type']
    App\Service\Scormia\Block\OrderBlock:
        tags: ['scormia.block_type']

    App\Service\Scormia\Block\BlockTypeRegistry:
        arguments:
            $types: !tagged_iterator scormia.block_type

    App\Service\Scormia\Export\ScormPackageExporter:
        arguments:
            $publicDir: '%kernel.project_dir%/public'
            $cacheDir: '%kernel.cache_dir%/scormia'

    App\Service\Scormia\Import\ScormiaPackageImporter:
        arguments:
            $projectDir: '%kernel.project_dir%'

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

    App\Service\User\UserEmailService:
        arguments:
            $appSecret: '%env(APP_SECRET)%'
