# 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:
    default_base_url: 'https://www.antiquites-en-france.com'
    app.google_analytics_id: '%env(GOOGLE_ANALYTICS_ID)%'
    app.base_url: '%env(default:default_base_url:APP_BASE_URL)%'
    # reCAPTCHA configuration
    app.recaptcha_site_key: '%env(RECAPTCHA_SITE_KEY)%'
    app.recaptcha_secret_key: '%env(RECAPTCHA_SECRET_KEY)%'
    # Email configuration
    app.notification_from_email: 'noreply@antiquites-en-france.com'

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
    
    # Image Upload Service configuration
    App\Service\ImageUploadService:
        arguments:
            $uploadsDirectory: '%kernel.project_dir%/public/uploads'
    
    # Member Branding Service configuration
    App\Service\MemberBrandingService:
        arguments:
            $uploadsDirectory: '%kernel.project_dir%/public/uploads'
    
    App\Service\DashboardStatsService:
        public: true
    
    # Elasticsearch Service configuration
    App\Service\ElasticsearchService:
        arguments:
            $itemPersister: '@fos_elastica.object_persister.aef_items'
            $memberPersister: '@fos_elastica.object_persister.aef_members'
    
    # SEO Service configuration
    App\Service\SeoService:
        arguments:
            $baseUrl: '%env(default:default_base_url:APP_BASE_URL)%'
    
    # Configuration SEO Extension Twig
    App\Twig\SeoExtension:
        tags: ['twig.extension']
    
    # PayPal Service configuration
    App\Service\PaypalService:
        arguments:
            $paypalClientId: '%env(PAYPAL_CLIENT_ID)%'
            $paypalClientSecret: '%env(PAYPAL_CLIENT_SECRET)%'
            $paypalMode: '%env(default:sandbox:PAYPAL_MODE)%'

    # Configuration du service de traduction OpenAI
    App\Service\ExternalTranslationService:
        arguments:
            $openaiApiKey: '%env(OPENAI_API_KEY)%'

    # Configuration explicite des handlers avec logging
    App\MessageHandler\TranslationRequestHandler:
        tags:
            - { name: messenger.message_handler }

    App\MessageHandler\TranslationProcessHandler:
        tags:
            - { name: messenger.message_handler }

    App\MessageHandler\TranslationUpdateHandler:
        tags:
            - { name: messenger.message_handler }

    # Configuration spécifique pour MemberManagementService
    App\Service\MemberManagementService:
        arguments:
            $stripeSecretKey: '%env(STRIPE_SECRET_KEY)%'
    
    # Configuration du service reCAPTCHA
    App\Service\RecaptchaService:
        arguments:
            $recaptchaSecretKey: '%app.recaptcha_secret_key%'
            $recaptchaEnabled: '%env(bool:RECAPTCHA_ENABLED)%'

    # Extension Twig reCAPTCHA
    App\Twig\RecaptchaExtension:
        arguments:
            $recaptchaSiteKey: '%app.recaptcha_site_key%'
        tags: ['twig.extension']

    # Extension Twig Locale
    App\Twig\LocaleExtension:
        tags: ['twig.extension']

    # Configuration du service Google Maps
    App\Service\GoogleMapsService:
        arguments:
            $apiKey: '%env(GOOGLE_MAPS_API_KEY)%'

    # Configuration du service GPS
    App\Service\GpsLocationService:
        arguments:
            $googleMapsService: '@App\Service\GoogleMapsService'

    # Configuration du service de vérification d'email
    App\Service\EmailVerificationService:
        public: true
        arguments:
            $fromEmail: '%app.notification_from_email%'

    # Configuration du LocaleService pour accès dans Twig
    App\Service\LocaleService:
        public: true

    # Configuration du PaymentService pour Stripe Connect
    App\Service\PaymentService:
        arguments:
            $stripeSecretKey: '%env(STRIPE_SECRET_KEY)%'
            $stripePublishableKey: '%env(STRIPE_PUBLISHABLE_KEY)%'

    # Configuration du ShippingService avec logging
    App\Service\ShippingService:
        arguments:
            $logger: '@logger'

    # Configuration du CartService sécurisé
    App\Service\CartService: ~

    # Configuration Stripe Connect - Phase 4
    App\Service\StripeConnectService:
        arguments:
            $stripeSecretKey: '%env(STRIPE_SECRET_KEY)%'
            $appUrl: '%env(APP_URL)%'
        tags:
            - { name: 'monolog.logger', channel: 'stripe_connect' }

    App\Service\FinanceService:
        tags:
            - { name: 'monolog.logger', channel: 'finance' }

    App\Service\RefundService:
        tags:
            - { name: 'monolog.logger', channel: 'refund' }

    # Controller Webhook Stripe
    App\Controller\StripeWebhookController:
        arguments:
            $stripeSecretKey: '%env(STRIPE_SECRET_KEY)%'
            $webhookSecret: '%env(STRIPE_WEBHOOK_SECRET)%'
        tags:
            - { name: 'monolog.logger', channel: 'stripe_webhook' }
