parameters:
    # locale: fr_FR
    openai_api_key: '%env(OPENAI_API_KEY)%'
    openai_default_model: 'gpt-5.1'
    openai_model: '%env(default:openai_default_model:OPENAI_MODEL)%'
    openai_chat_default_model: 'gpt-4o-mini'
    openai_chat_model: '%env(default:openai_chat_default_model:OPENAI_CHAT_MODEL)%'
    sylius_refund.supported_gateways:
        - payplug
        - payplug_oney
        - payplug_bancontact
        - payplug_apple_pay
        - payplug_american_express

spinbits_sylius_google_analytics4:
    id: '%env(GA4)%' # Remplacez par votre identifiant Google Analytics 4


services:
    # Default configuration for services in *this* file
    _defaults:
        # Automatically injects dependencies in your services
        autowire: true

        # Automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
                    

        # Allows optimizing the container by removing unused services; this also means
        # fetching services directly from the container via $container->get() won't work
        public: false


    _instanceof:
        Sylius\Bundle\ResourceBundle\Controller\ResourceController:
            autowire: false
        Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType:
            autowire: false

    App\EventListener\SitemapListener:
        arguments:
            $productRepository: '@sylius.repository.product'
            $taxonRepository: '@sylius.repository.taxon'
        tags:
            - { name: kernel.event_subscriber }

    # 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/{Entity,Migrations,Tests,Kernel.php,Repository}'

    # Controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
        resource: '../src/Controller'
        tags: ['controller.service_arguments']
        
    App\Controller\ProductController:
        autowire: false
        
    # Définition du service ProductAttributeHandler
    App\Command\Seed\ProductAttributeHandler:
        arguments:
            $entityManager: '@doctrine.orm.entity_manager'
    
    App\EventSubscriber\RedirectIndexPhpSubscriber: 
        tags:
            - { name: kernel.event_subscriber }

    App\EventSubscriber\RedirectSubscriber:
        tags:
            - { name: kernel.event_subscriber }


    App\Form\Extension\AddressTypeExtension:
        tags:
            - { name: form.type_extension, extended_type: Sylius\Bundle\AddressingBundle\Form\Type\AddressType }

    App\EventListener\G4CheckoutEventListener:
        arguments:
            $checkoutEventFactory: '@Spinbits\SyliusGoogleAnalytics4Plugin\Factory\CheckoutEventFactory' # Nom correct pour CheckoutEventFactory
            $eventsStorage: '@Spinbits\SyliusGoogleAnalytics4Plugin\Storage\EventsBag' # Nom correct pour EventsBag
        tags:
            - { name: 'kernel.event_subscriber' }

    Spinbits\SyliusGoogleAnalytics4Plugin\EventListener\CheckoutEventListener:
        tags: []
        public: false
        autowire: false
        autoconfigure: false


    App\EventListener\G4NavigationEventListener:
        arguments:
            $navEventFactory: '@Spinbits\SyliusGoogleAnalytics4Plugin\Factory\NavigationEventFactory'  # Correct the typo here
            $eventsStorage: '@Spinbits\SyliusGoogleAnalytics4Plugin\Storage\EventsBag'  # Ensure this service is correct
        tags:
            - { name: 'kernel.event_subscriber' }

    Spinbits\SyliusGoogleAnalytics4Plugin\EventListener\NavigationEventListener:
        tags: []
        public: false
        autowire: false
        autoconfigure: false
        
    App\Twig\AppTwigExtension:
        tags: [ 'twig.extension' ]


    app.listener.admin.menu_builder:
        class: App\Menu\AdminMenuListener
        tags:
            - { name: kernel.event_listener, event: sylius.menu.admin.main, method: addAdminMenuItems }


# config/services.yaml
    App\EventListener\PaymentCompleteListener:
        public: true  # Make the service public
        arguments:
            $logger: '@logger'
            $dispatcher: '@event_dispatcher'
        tags:
            - { name: 'kernel.event_listener', event: 'sylius.payment.post_complete', method: 'onPaymentComplete' }

    App\Supplier\Service\OpenAIService:
        arguments:
            $apiKey: '%openai_api_key%'
            $model: '%openai_model%'
            $chatModel: '%openai_chat_model%'

    # Google Merchant internal services
    App\Repository\GoogleMerchant\GoogleMerchantFeedRepository:
        alias: 'app.repository.google_merchant_feed'
        public: false

    App\Repository\GoogleMerchant\GoogleMerchantFeedVariantRepository:
        arguments:
            $registry: '@doctrine'

    App\Repository\SupplierRepository:
        arguments:
            $registry: '@doctrine'

    App\Form\Extension\ProductVariantTypeExtension:
        tags:
            - { name: form.type_extension, extended_type: Sylius\Bundle\ProductBundle\Form\Type\ProductVariantType }

    App\Form\Extension\ProductTypeExtension:
        tags:
            - { name: form.type_extension, extended_type: Sylius\Bundle\ProductBundle\Form\Type\ProductType }

    App\Form\Extension\ProductTranslationTypeExtension:
        tags:
            - { name: form.type_extension, extended_type: Sylius\Bundle\ProductBundle\Form\Type\ProductTranslationType }

    App\Form\EventSubscriber\ProductVariantGoogleMerchantSubscriber: ~

    App\GoogleMerchant\FeedGenerator:
        arguments:
            $productRepository: '@sylius.repository.product'
            $router: '@router'
            $baseUrl: '%env(APP_SCHEME)%://%env(APP_HOST)%'
            $publicDir: '%kernel.project_dir%/public'

    App\Command\GoogleMerchantGenerateFeedsCommand:
        arguments:
            $feedRepository: '@app.repository.google_merchant_feed'

            
