parameters:
    oro_datagrid.datagrid.name_strategy.class:   Oro\Bundle\DashboardBundle\Datagrid\NameStrategy

    oro_dashboard.config_resolver.class:         Oro\Component\Config\Resolver\SystemAwareResolver
    oro_dashboard.manager.state.class:           Oro\Bundle\DashboardBundle\Model\StateManager
    oro_dashboard.manager.class:                 Oro\Bundle\DashboardBundle\Model\Manager
    oro_dashboard.widget_configs.class:          Oro\Bundle\DashboardBundle\Model\WidgetConfigs
    oro_dashboard.factory.class:                 Oro\Bundle\DashboardBundle\Model\Factory
    oro_dashboard.config_provider.class:         Oro\Bundle\DashboardBundle\Model\ConfigProvider
    oro_dashboard.dashboard_entity.class:        Oro\Bundle\DashboardBundle\Entity\Dashboard
    oro_dashboard.dashboard_widget_entity.class: Oro\Bundle\DashboardBundle\Entity\Widget
    oro_dashboard.navigation_listener.class:     Oro\Bundle\DashboardBundle\EventListener\NavigationListener
    oro_dashboard.form.type.edit.class:          Oro\Bundle\DashboardBundle\Form\Type\DashboardType
    oro_dashboard.form.type.select.class:        Oro\Bundle\DashboardBundle\Form\Type\DashboardSelectType
    oro_dashboard.provider.widget_configuration_form_provider.class:  Oro\Bundle\DashboardBundle\Provider\WidgetConfigurationFormProvider
    oro_dashboard.widget_config_value.provider.class: Oro\Bundle\DashboardBundle\Provider\ConfigValueProvider
    oro_dashboard.datetime.helper.class: Oro\Bundle\DashboardBundle\Helper\DateHelper
    oro_dashboard.event_listener.widget_configuration_load.class: Oro\Bundle\DashboardBundle\EventListener\WidgetConfigurationLoadListener
    oro_dashboard.event_listener.widget_items_load_data.class: Oro\Bundle\DashboardBundle\EventListener\WidgetItemsLoadDataListener
    oro_dashboard.event_listener.widget_sort_by.class: Oro\Bundle\DashboardBundle\EventListener\WidgetSortByListener

    oro_dashboard.widget_config_value.previous_date_range.converter.class: Oro\Bundle\DashboardBundle\Provider\Converters\PreviousFilterDateRangeConverter
    oro_dashboard.widget_config_value.widget_title.converter.class: Oro\Bundle\DashboardBundle\Provider\Converters\WidgetTitleConverter
    oro_dashboard.widget_config_value.widget_items_choice.converter.class: Oro\Bundle\DashboardBundle\Provider\Converters\WidgetItemsChoiceTypeConverter
    oro_dashboard.widget_config_value.widget_sort_by.converter.class: Oro\Bundle\DashboardBundle\Provider\Converters\WidgetSortByConverter

    oro_dashboard.form.type.widget_date_range.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetDateRangeType
    oro_dashboard.form.type.date_range_value.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetDateRangeValueType
    oro_dashboard.form.type.widget_widget_title.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetTitleType
    oro_dashboard.form.type.widget_previous_date_rang.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetPreviousDateRangeType
    oro_dashboard.form.type.widget_items_choice.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetItemsChoiceType
    oro_dashboard.form.type.widget_items.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetItemsType
    oro_dashboard.form.type.widget_item.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetItemType
    oro_dashboard.event_listener.widget_items_form_subscriber.class: Oro\Bundle\DashboardBundle\Form\EventListener\WidgetItemsFormSubscriber
    oro_dashboard.form.type.widget_date.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetDateType
    oro_dashboard.form.type.widget_sort_by.class: Oro\Bundle\DashboardBundle\Form\Type\WidgetSortByType

    # BigNumber
    oro_dashboard.provider.big_number.processor.class:   Oro\Bundle\DashboardBundle\Provider\BigNumber\BigNumberProcessor
    oro_dashboard.provider.big_number.formatter.class:   Oro\Bundle\DashboardBundle\Provider\BigNumber\BigNumberFormatter
    oro_dashboard.provider.big_number.date_helper.class: Oro\Bundle\DashboardBundle\Provider\BigNumber\BigNumberDateHelper

services:
    oro_datagrid.datagrid.name_strategy:
        class: %oro_datagrid.datagrid.name_strategy.class%
        calls:
            - [setRequest, ["@?request="]]

    oro_dashboard.config_resolver:
        class: %oro_dashboard.config_resolver.class%
        arguments:
            - '@service_container'

    oro_dashboard.widget_configs:
        class: %oro_dashboard.widget_configs.class%
        arguments:
            - '@oro_dashboard.config_provider'
            - '@oro_security.security_facade'
            - '@oro_dashboard.config_resolver'
            - '@doctrine.orm.entity_manager'
            - '@oro_dashboard.widget_config_value.provider'
            - '@translator'
            - '@event_dispatcher'
        calls:
            - [setRequest, ["@?request="]]

    oro_dashboard.manager:
        class: %oro_dashboard.manager.class%
        arguments:
            - '@oro_dashboard.factory'
            - '@doctrine.orm.entity_manager'
            - '@oro_security.acl_helper'
            - '@security.context'

    oro_dashboard.factory:
        class: %oro_dashboard.factory.class%
        arguments:
            - '@oro_dashboard.config_provider'
            - '@oro_dashboard.manager.state'

    oro_dashboard.manager.state:
        class: %oro_dashboard.manager.state.class%
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_security.security_facade'

    oro_dashboard.config_provider:
        class: %oro_dashboard.config_provider.class%
        arguments:
            - []
            - '@event_dispatcher'

    oro_dashboard.navigation_listener:
        class: %oro_dashboard.navigation_listener.class%
        arguments:
            - '@oro_security.security_facade'
            - '@oro_dashboard.manager'
        tags:
            - { name: kernel.event_listener, event: oro_menu.configure.application_menu, method: onNavigationConfigure }

    oro_dashboard.form.type.edit:
        class: %oro_dashboard.form.type.edit.class%
        tags:
            - { name: form.type, alias: "oro_dashboard" }

    oro_dashboard.form.type.select:
        class: %oro_dashboard.form.type.select.class%
        arguments:
            - '@oro_dashboard.manager'
        tags:
            - { name: form.type, alias: "oro_dashboard_select" }

    oro_dashboard.provider.widget_configuration_form_provider:
        class: %oro_dashboard.provider.widget_configuration_form_provider.class%
        arguments:
            - '@oro_dashboard.config_provider'
            - '@form.factory'

    oro_dashboard.datetime.helper:
        class: %oro_dashboard.datetime.helper.class%
        arguments:
            - '@oro_locale.settings'
            - '@doctrine'
            - '@oro_security.acl_helper'

    oro_dashboard.event_listener.widget_configuration_load:
        class: %oro_dashboard.event_listener.widget_configuration_load.class%
        arguments:
            - '@oro_datagrid.datagrid.manager.link'
            - '@oro_datagrid.datagrid.builder'
        tags:
            - { name: kernel.event_listener, event: oro_dashboard.widget_configuration_load, method: onWidgetConfigurationLoad }

    oro_dashboard.event_listener.widget_items_load_data:
        class: %oro_dashboard.event_listener.widget_items_load_data.class%
        tags:
            - { name: kernel.event_listener, event: oro_dashboard.widget_items_load_data, method: filterItemsByItemsChoice }
            - { name: kernel.event_listener, event: oro_dashboard.widget_items_load_data, method: filterItems }

    oro_dashboard.event_listener.widget_sort_by:
        class: %oro_dashboard.event_listener.widget_sort_by.class%
        arguments:
            - '@oro_dashboard.widget_configs'
        abstract: true

    oro_dashboard.type.widget_jqueryselect2_hidden:
        class: Oro\Bundle\DashboardBundle\Form\Type\WidgetEntityJquerySelect2HiddenType
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_form.autocomplete.search_registry'
            - '@oro_entity_config.provider.form'
            - '@oro_entity.doctrine_helper'
        tags:
            - { name: form.type, alias: oro_widget_entity_jqueryselect2_hidden }

    oro_dashboard.form.type.widget_date_range:
        class: %oro_dashboard.form.type.widget_date_range.class%
        arguments:
            - '@translator'
        tags:
            - { name: form.type, alias: "oro_type_widget_date_range" }

    oro_dashboard.form.type.widget_datetime_range:
        class: Oro\Bundle\DashboardBundle\Form\Type\WidgetDateTimeRangeType
        tags:
            - { name: form.type, alias: "oro_type_widget_datetime_range" }

    oro_dashboard.form.type.widget_date_range_value:
        class: %oro_dashboard.form.type.date_range_value.class%
        tags:
            - { name: form.type, alias: "oro_type_widget_date_range_value" }

    oro_dashboard.form.type.widget_previous_date_range:
        class: %oro_dashboard.form.type.widget_previous_date_rang.class%
        tags:
            - { name: form.type, alias: "oro_type_widget_previous_date_range" }

    oro_dashboard.form.type.widget_widget_title:
        class: %oro_dashboard.form.type.widget_widget_title.class%
        tags:
            - { name: form.type, alias: "oro_type_widget_title" }

    oro_dashboard.form.type.widget_items_choice:
        class: %oro_dashboard.form.type.widget_items_choice.class%
        tags:
            - { name: form.type, alias: "oro_type_widget_items_choice" }

    oro_dashboard.form.type.widget_choice:
        class: Oro\Bundle\DashboardBundle\Form\Type\WidgetChoiceType
        tags:
            - { name: form.type, alias: "oro_type_widget_choice" }

    oro_dashboard.form.type.widget_item:
        class: %oro_dashboard.form.type.widget_item.class%
        tags:
            - { name: form.type, alias: oro_type_widget_item }

    oro_dashboard.form.type.widget_items:
        class: %oro_dashboard.form.type.widget_items.class%
        arguments:
            - '@oro_dashboard.event_listener.widget_items_form_subscriber'
        tags:
            - { name: form.type, alias: oro_type_widget_items }

    oro_dashboard.event_listener.widget_items_form_subscriber:
        class: %oro_dashboard.event_listener.widget_items_form_subscriber.class%
        arguments:
            - '@oro_dashboard.widget_configs'
            - '@translator'

    oro_dashboard.widget_config_value.provider:
        class: %oro_dashboard.widget_config_value.provider.class%

    oro_dashboard.widget_config_value.date_range.converter:
        class: Oro\Bundle\DashboardBundle\Provider\Converters\FilterDateRangeConverter
        arguments:
            - '@oro_locale.formatter.date_time'
            - '@oro_filter.expression.date.compiler'
            - '@translator'
            - '@oro_dashboard.datetime.helper'
        tags:
            - { name: oro_dashboard.value.converter, alias: "oro_type_widget_date_range" }

    oro_dashboard.widget_config_value.datetime_range.converter:
        class: Oro\Bundle\DashboardBundle\Provider\Converters\FilterDateTimeRangeConverter
        arguments:
            - '@oro_dashboard.widget_config_value.date_range.converter'
            - '@oro_dashboard.config_resolver'
            - '@oro_dashboard.datetime.helper'
        tags:
            - { name: oro_dashboard.value.converter, alias: "oro_type_widget_datetime_range" }

    oro_dashboard.widget_config_value.previous_date_range.converter:
          class: %oro_dashboard.widget_config_value.previous_date_range.converter.class%
          parent: oro_dashboard.widget_config_value.date_range.converter
          tags:
              - { name: oro_dashboard.value.converter, alias: "oro_type_widget_previous_date_range" }

    oro_dashboard.widget_config_value.widget_title.converter:
        class: %oro_dashboard.widget_config_value.widget_title.converter.class%
        tags:
            - { name: oro_dashboard.value.converter, alias: "oro_type_widget_title" }

    oro_dashboard.widget_config_value.widget_items_choice.converter:
        class: %oro_dashboard.widget_config_value.widget_items_choice.converter.class%
        tags:
            - { name: oro_dashboard.value.converter, alias: "oro_type_widget_items_choice" }

    oro_dashboard.widget_config_value.widget_choice.converter:
        class: Oro\Bundle\DashboardBundle\Provider\Converters\WidgetChoiceTypeConverter
        tags:
            - { name: oro_dashboard.value.converter, alias: "oro_type_widget_choice" }

    oro_dashboard.widget_config_value.widget_sort_by.converter:
        class: %oro_dashboard.widget_config_value.widget_sort_by.converter.class%
        arguments:
            - '@oro_entity_config.provider.entity'
            - '@translator'
        tags:
            - { name: oro_dashboard.value.converter, alias: oro_type_widget_sort_by }

    oro_dashboard.form.type.widget_date:
        class: %oro_dashboard.form.type.widget_date.class%
        tags:
            - { name: form.type, alias: "oro_type_widget_date" }

    oro_dashboard.form.type.widget_sort_by:
        class: %oro_dashboard.form.type.widget_sort_by.class%
        arguments:
            - '@oro_entity.entity_field_provider'
        tags:
            - { name: form.type, alias: oro_type_widget_sort_by }

    # BigNumber
    oro_dashboard.provider.big_number.processor:
        class: %oro_dashboard.provider.big_number.processor.class%
        arguments:
            - '@oro_dashboard.provider.big_number.formatter'
            - '@oro_dashboard.provider.big_number.date_helper'
            - '@oro_user.dashboard.owner_helper'

    oro_dashboard.provider.big_number.formatter:
        class: %oro_dashboard.provider.big_number.formatter.class%
        arguments:
            - '@oro_locale.formatter.number'

    oro_dashboard.provider.big_number.date_helper:
        class: %oro_dashboard.provider.big_number.date_helper.class%
        arguments:
            - '@doctrine'
            - '@oro_security.acl_helper'
            - '@oro_locale.settings'

    oro_dashboard.filter.date_range:
        class: Oro\Bundle\DashboardBundle\Filter\DateRangeFilter
        parent: oro_filter.date_range_filter

    oro_dashboard.filter.date_filter_processor:
        class: Oro\Bundle\DashboardBundle\Filter\DateFilterProcessor
        arguments:
            - '@oro_dashboard.filter.date_range'
            - '@oro_filter.utils.date_filter_modifier'

    # Twig extension
    oro_dashboard.twig.extension:
        class: Oro\Bundle\DashboardBundle\Twig\DashboardExtension
        arguments:
            - '@oro_dashboard.widget_config_value.date_range.converter'
            - '@oro_query_designer.query_designer.manager'
            - '@oro_report.entity_provider'
        tags:
            - { name: twig.extension }

    oro_dashboard.form.type.widget_filter:
        class: Oro\Bundle\DashboardBundle\Form\Type\WidgetFilterType
        tags:
            - { name: form.type, alias: oro_dashboard_query_filter }
