# 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.upload_dir_posts: '%kernel.project_dir%/public/uploads/posts/'
    logo_mecene_directory: '%kernel.project_dir%/public/uploads/mecenes/logos/'
    logo_societe_directory: '%kernel.project_dir%/public/uploads/societes/logos/'
    logo_projet_directory: '%kernel.project_dir%/public/uploads/projets/logos/'
    presentation_projet_directory: '%kernel.project_dir%/public/uploads/projets/presentations/'
    app.base_url: '%env(APP_BASE_URL)%'
    app.base_routing_url: '%env(APP_BASE_ROUTING_URL)%'
    app.public_path: '%env(APP_PUBLIC_PATH)%'
    app.version: '%env(VERSION_APP)%'
    fundup_storage: '%kernel.project_dir%/var/fundup/'
    brandfetch.api_base_url: '%env(BRANDFETCH_API_BASE_URL)%'
    brandfetch.allowed_hosts: '%env(json:BRANDFETCH_ALLOWED_HOSTS)%'
    stripe.secret_key: '%env(default::STRIPE_SECRET_KEY)%'
    stripe.public_key: '%env(default::STRIPE_PUBLIC_KEY)%'
    stripe.webhook_secret: '%env(default::STRIPE_WEBHOOK_SECRET)%'
    app.error_support_email: 'nicolas.agnelot@rexane.fr'
    app.error_mail_from: 'noreply@fundup.fr'
    app.error_not_found_route: 'app_error_404'
    app.error_notifications_enabled: true
    app.error_notifications_in_dev: false
    project_onboarding.allowed_extensions: ['pdf', 'png', 'jpg', 'jpeg', 'webp', 'zip']
    project_onboarding.max_file_size: 10485760
    project_onboarding.max_file_size_label: '10M'
    app.email_attachments_dir: '%fundup_storage%emails/attachments'
    app.email_default_from: 'noreply@fundup.fr'
    gemini.model_default: 'gemini-2.5-flash'
    gemini.api_key: '%env(default::GEMINI_API_KEY)%'
    gemini.model: '%env(default:gemini.model_default:GEMINI_MODEL)%'
    app.bundle_routes:
        ProjetBundle:
            - '^/projet'
            - '^/tache'
            - '^/ticket'
        CommercialBundle:
            - '^/client'
            - '^/prospect'
            - '^/facture'
            - '^/devis'
            - '^/depenses'
            - '^/produit'
        AdminBundle:
            - '^/societe'
            - '^/user'
            - '^/update'

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
    # please note that last definitions always *replace* previous ones

    App\EventListener\SocieteListener:
        public: true
        autowire: true
        autoconfigure: true
        tags:
            - { name: kernel.event_listener, event: kernel.request, priority: 10 }

    App\EventListener\PortailRedirectionListener:
        public: true
        autowire: true
        autoconfigure: true
        tags:
            - { name: kernel.event_listener, event: kernel.controller, method: onKernelController, priority: 15 }

    App\EventListener\RedirectToPublicListener:
        tags:
            - { name: kernel.event_listener, event: kernel.request, priority: 10 }

    App\EventListener\BundleCheckListener:
        tags:
            - { name: kernel.event_listener, event: kernel.request, priority: 10 }

    App\Service\SireneService:
        arguments:
            $apiKey: '%env(INSEE_API_KEY)%'
        
    App\Twig\ModuleExtension:
        tags: ['twig.extension']

    App\Service\FileManagerService:
        arguments:
            $baseDir: '%kernel.project_dir%/var/fundup/'

    App\Bundle\AppBundle\Service\BrandfetchLogoService:
        arguments:
            $apiKey: '%env(BRANDFETCH_API_KEY)%'
            $apiBaseUrl: '%brandfetch.api_base_url%'
            $storageDir: '%logo_mecene_directory%'
            $publicPrefix: '/uploads/mecenes/logos/'
            $allowedHostSuffixes: '%brandfetch.allowed_hosts%'
            $cache: '@cache.app'

    App\Bundle\AppBundle\Service\Billing\StripeCheckoutService:
        arguments:
            $stripeSecretKey: '%stripe.secret_key%'

    App\Bundle\AppBundle\Service\Ai\GeminiCompanyPresentationGenerator:
        arguments:
            $apiKey: '%gemini.api_key%'
            $model: '%gemini.model%'

    App\Bundle\AppBundle\Service\Ai\GeminiFormulaComplianceService:
        arguments:
            $apiKey: '%gemini.api_key%'
            $model: '%gemini.model%'

    App\Bundle\AppBundle\Service\Ai\GeminiConventionComplianceService:
        arguments:
            $apiKey: '%gemini.api_key%'
            $model: '%gemini.model%'

    App\Bundle\AppBundle\Service\Ai\GeminiProjectDescriptionGenerator:
        arguments:
            $apiKey: '%gemini.api_key%'
            $model: '%gemini.model%'

    App\Bundle\AppBundle\Controller\StripeWebhookController:
        arguments:
            $stripeWebhookSecret: '%stripe.webhook_secret%'

    App\Bundle\AppBundle\Service\Convention\ConventionPdfTextExtractor:
        arguments:
            $storageBaseDir: '%fundup_storage%'

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

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

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

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

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

    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\Bundle\ProjetBundle\Service\ProjectOnboardingUploadService:
        arguments:
            $storageBaseDir: '%fundup_storage%'
            $allowedExtensions: '%project_onboarding.allowed_extensions%'
            $maxFileSize: '%project_onboarding.max_file_size%'

    App\Bundle\ProjetBundle\Controller\ProjectOnboardingController:
        arguments:
            $maxFileSizeLabel: '%project_onboarding.max_file_size_label%'
            $allowedExtensions: '%project_onboarding.allowed_extensions%'

    App\Bundle\DashboardBundle\Service\DashboardService:
        arguments:
            $appVersion: '%app.version%'

    App\Bundle\ProjetBundle\Service\Report\Pdf\PdfEngineInterface: '@App\Bundle\ProjetBundle\Service\Report\Pdf\TcpdfPdfEngine'
    App\Bundle\ProjetBundle\Service\Report\Storage\ReportStorageInterface: '@App\Bundle\ProjetBundle\Service\Report\Storage\LocalReportStorage'

    App\Bundle\DashboardBundle\Service\Admin\ResourceAttachmentManager:
        arguments:
            $projectDir: '%kernel.project_dir%'
