parameters:
    kunstmaan_dashboard.widget.googleanalytics.command: Kunstmaan\DashboardBundle\Command\GoogleAnalyticsDataCollectCommand
    kunstmaan_dashboard.widget.googleanalytics.controller: Kunstmaan\DashboardBundle\Controller\GoogleAnalyticsController
    kunstmaan_dashboard.googleclient.class: 'Google_Client'
    kunstmaan_dashboard.googleclienthelper.class: 'Kunstmaan\DashboardBundle\Helper\Google\ClientHelper'

services:
    kunstmaan_dashboard.manager.widgets:
        class: Kunstmaan\DashboardBundle\Manager\WidgetManager
        public: true

    kunstmaan_dashboard.widget.googleanalytics:
        class: Kunstmaan\DashboardBundle\Widget\DashboardWidget
        arguments: ['%kunstmaan_dashboard.widget.googleanalytics.command%', '%kunstmaan_dashboard.widget.googleanalytics.controller%', '@service_container']
        tags:
            - { name: kunstmaan_dashboard.widget, priority: 1 }

    # google client
    kunstmaan_dashboard.googleclient:
        class: '%kunstmaan_dashboard.googleclient.class%'
        calls:
          - [ 'setApplicationName', [ '%kunstmaan_dashboard.google_analytics.api.app_name%' ] ]
          - [ 'setClientId', [ '%kunstmaan_dashboard.google_analytics.api.client_id%' ] ]
          - [ 'setClientSecret', [ '%kunstmaan_dashboard.google_analytics.api.client_secret%' ] ]
          - [ 'setDeveloperKey', [ '%kunstmaan_dashboard.google_analytics.api.dev_key%' ] ]
          - [ 'setScopes', [ 'https://www.googleapis.com/auth/analytics.readonly' ] ]
          - [ 'setUseObjects', [ true ] ]

    # client helper
    kunstmaan_dashboard.helper.google.client:
        class: 'Kunstmaan\DashboardBundle\Helper\Google\ClientHelper'
        arguments: ['@kunstmaan_dashboard.googleclient', '@router', 'KunstmaanDashboardBundle_setToken']
        public: true

    # service helper
    kunstmaan_dashboard.helper.google.analytics.service:
        class: 'Kunstmaan\DashboardBundle\Helper\Google\Analytics\ServiceHelper'
        arguments: ['@kunstmaan_dashboard.helper.google.client']
        public: true

    # config helper
    kunstmaan_dashboard.helper.google.analytics.config:
        class: 'Kunstmaan\DashboardBundle\Helper\Google\Analytics\ConfigHelper'
        arguments: ['@kunstmaan_dashboard.helper.google.analytics.service', '@doctrine.orm.entity_manager']
        public: true

    # query helper
    kunstmaan_dashboard.helper.google.analytics.query:
        class: 'Kunstmaan\DashboardBundle\Helper\Google\Analytics\QueryHelper'
        arguments: ['@kunstmaan_dashboard.helper.google.analytics.service', '@kunstmaan_dashboard.helper.google.analytics.config']
        public: true
