parameters:
    oro_warehouse.entity.warehouse.class: Oro\Bundle\WarehouseBundle\Entity\Warehouse
    oro_warehouse.entity.warehouse_inventory_level.class: Oro\Bundle\WarehouseBundle\Entity\WarehouseInventoryLevel

services:
    oro_warehouse.warehouse_inventory_level.manager.api:
        class: 'Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager'
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '%oro_warehouse.entity.warehouse_inventory_level.class%'
            - "@doctrine.orm.entity_manager"

    oro_warehouse.entity.helper.warehouse_counter:
        class: 'Oro\Bundle\WarehouseBundle\Entity\Helper\WarehouseCounter'
        arguments: ["@oro_entity.doctrine_helper"]

    oro_warehouse.api.processor.product_id.normalize_input:
        class: 'Oro\Bundle\ProductBundle\Api\Processor\NormalizeProductId'
        tags:
            - { name: oro.api.processor, action: update, group: normalize_input, priority: -105, class: '%oro_warehouse.entity.warehouse_inventory_level.class%' }

    oro_warehouse.api.processor.entity_id.load_data:
        class: 'Oro\Bundle\ProductBundle\Api\Processor\LoadEntityId'
        tags:
            - { name: oro.api.processor, action: update, group: load_data, priority: -50, class: '%oro_warehouse.entity.warehouse_inventory_level.class%' }

    oro_warehouse.api.processor.update_warehouse_inventory_level.build_query:
        class: 'Oro\Bundle\WarehouseBundle\Api\Processor\BuildSingleWarehouseInventoryLevelQuery'
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_api.criteria_connector'
            - '@oro_warehouse.entity.helper.warehouse_counter'
        tags:
            - { name: oro.api.processor, action: update, group: build_query, priority: -95, class: '%oro_warehouse.entity.warehouse_inventory_level.class%' }

    oro_warehouse.api.processor.create_warehouse_inventory_level.normalize_input:
        class: 'Oro\Bundle\WarehouseBundle\Api\Processor\NormalizeInventoryLevelRequestData'
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_warehouse.entity.helper.warehouse_counter'
        tags:
            - { name: oro.api.processor, action: create, group: normalize_input, priority: -45, class: '%oro_warehouse.entity.warehouse_inventory_level.class%' }

    oro_warehouse.form.autocomplete.warehouse.search_handler:
        public: false
        parent: oro_form.autocomplete.search_handler
        arguments:
            - '%oro_warehouse.entity.warehouse.class%'
            - ["name"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_warehouse, acl_resource: oro_warehouse_view }

    oro_warehouse.validator.unique_warehouse:
        class: 'Oro\Bundle\WarehouseBundle\Validator\Constraints\UniqueWarehouseValidator'
        tags:
            - { name: validator.constraint_validator, alias: oro_warehouse_unique_warehouse_validator }

    oro_warehouse.event_listener.system_config:
        class: 'Oro\Bundle\WarehouseBundle\EventListener\WarehouseSystemConfigSubscriber'
        arguments:
            - '@oro_warehouse.system_config_converter'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: formPreSet }
            - { name: kernel.event_listener, event: oro_config.settings_before_save, method: beforeSave }

    oro_warehouse.system_config_converter:
        class: 'Oro\Bundle\WarehouseBundle\SystemConfig\WarehouseConfigConverter'
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '%oro_warehouse.entity.warehouse.class%'

    oro_warehouse.event_listener.product_manage_inventory_form_view_listener:
        class: 'Oro\Bundle\WarehouseBundle\EventListener\ProductManageInventoryFormViewListener'
        arguments:
            - "@request_stack"
            - "@oro_entity.doctrine_helper"
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-view, method: onProductView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-edit, method: onProductEdit }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-create-step-two, method: onProductEdit }

    oro_warehouse.event_listener.category_manage_inventory_form_view:
        class: 'Oro\Bundle\WarehouseBundle\EventListener\CategoryManageInventoryFormViewListener'
        arguments:
            - "@request_stack"
            - "@oro_entity.doctrine_helper"
            - "@translator"
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.category-edit, method: onCategoryEdit }
