parameters:
    emoe_guzzle.request.format: '{request}'
    emoe_guzzle.response.format: '{response}'

services:
    emoe_guzzle.handler_stack:
        class: 'GuzzleHttp\HandlerStack'
        public: false
        factory: ['GuzzleHttp\HandlerStack', create]

    emoe_guzzle.request_profiler_middleware:
        class: 'Emoe\GuzzleBundle\Middleware\RequestProfilerMiddleware'
        public: false
        arguments:
            - '@?debug.stopwatch'

    emoe_guzzle.request_logger_middleware:
        class: 'Emoe\GuzzleBundle\Middleware\RequestLoggerMiddleware'
        public: false
        arguments:
            - '@emoe_guzzle.log_adapter'
            - '@emoe_guzzle.stopwatch'
            - '@emoe_guzzle.message_formatter'

    emoe_guzzle.stopwatch:
        class: 'Symfony\Component\Stopwatch\Stopwatch'
        public: false

    emoe_guzzle.log_adapter:
        class: 'Emoe\GuzzleBundle\Log\ArrayLogAdapter'
        public: false

    emoe_guzzle.message_formatter:
        class: 'GuzzleHttp\MessageFormatter'
        public: false

    emoe_guzzle.request_formatter:
        class: 'GuzzleHttp\MessageFormatter'
        public: false
        arguments:
            - '%emoe_guzzle.request.format%'

    emoe_guzzle.response_formatter:
        class: 'GuzzleHttp\MessageFormatter'
        public: false
        arguments:
            - '%emoe_guzzle.response.format%'

    emoe_guzzle.data_collector:
        class: 'Emoe\GuzzleBundle\DataCollector\GuzzleDataCollector'
        public: false
        arguments:
            - '@emoe_guzzle.log_adapter'
            - '@emoe_guzzle.request_formatter'
            - '@emoe_guzzle.response_formatter'
        tags:
            - { name: data_collector, template: '@EmoeGuzzle/Collector/guzzle.html.twig', id: 'guzzle' }

    guzzle.client:
        class: 'GuzzleHttp\Client'
        public: true
        tags:
            - { name: guzzle.client }
    
    GuzzleHttp\ClientInterface:
        alias: 'guzzle.client'
