parameters:
    oro_account.entity.account.class: Oro\Bundle\AccountBundle\Entity\Account
    oro_account.entity.account_address.class: Oro\Bundle\AccountBundle\Entity\AccountAddress
    oro_account.entity.account_group.class: Oro\Bundle\AccountBundle\Entity\AccountGroup
    oro_account.entity.account_user.class: Oro\Bundle\AccountBundle\Entity\AccountUser
    oro_account.entity.account_user_settings.class: Oro\Bundle\AccountBundle\Entity\AccountUserSettings
    oro_account.entity.account_user_address.class: Oro\Bundle\AccountBundle\Entity\AccountUserAddress
    oro_account.entity.account_user_role.class: Oro\Bundle\AccountBundle\Entity\AccountUserRole
    oro_account.entity.audit.class: Oro\Bundle\AccountBundle\Entity\Audit
    oro_account.entity.navigation_item.class: Oro\Bundle\AccountBundle\Entity\NavigationItem
    oro_account.entity.navigation_history_item.class: Oro\Bundle\AccountBundle\Entity\NavigationHistoryItem
    oro_account.entity.pinbar_tab.class: Oro\Bundle\AccountBundle\Entity\PinbarTab
    oro_account.entity.sidebar_state.class: Oro\Bundle\AccountBundle\Entity\AccountUserSidebarState
    oro_account.entity.widget.class: Oro\Bundle\AccountBundle\Entity\AccountUserSidebarWidget
    oro_account.entity.page_state.class: Oro\Bundle\AccountBundle\Entity\PageState
    oro_account.entity.category_visibility.class: Oro\Bundle\AccountBundle\Entity\Visibility\CategoryVisibility
    oro_account.entity.account_category_visibility.class: Oro\Bundle\AccountBundle\Entity\Visibility\AccountCategoryVisibility
    oro_account.entity.account_group_category_visibility.class: Oro\Bundle\AccountBundle\Entity\Visibility\AccountGroupCategoryVisibility
    oro_account.entity.category_visibility_resolved.class: Oro\Bundle\AccountBundle\Entity\VisibilityResolved\CategoryVisibilityResolved
    oro_account.entity.account_category_visibility_resolved.class: Oro\Bundle\AccountBundle\Entity\VisibilityResolved\AccountCategoryVisibilityResolved
    oro_account.entity.account_group_category_visibility_resolved.class: Oro\Bundle\AccountBundle\Entity\VisibilityResolved\AccountGroupCategoryVisibilityResolved
    oro_account.entity.product_visibility.class: Oro\Bundle\AccountBundle\Entity\Visibility\ProductVisibility
    oro_account.entity.account_product_visibility.class: Oro\Bundle\AccountBundle\Entity\Visibility\AccountProductVisibility
    oro_account.entity.account_group_product_visibility.class: Oro\Bundle\AccountBundle\Entity\Visibility\AccountGroupProductVisibility
    oro_account.entity.windows_state.class: Oro\Bundle\AccountBundle\Entity\WindowsState
    oro_account.entity.account_product_visibility_resolved.class: Oro\Bundle\AccountBundle\Entity\VisibilityResolved\AccountProductVisibilityResolved
    oro_account.entity.account_group_product_visibility_resolved.class: Oro\Bundle\AccountBundle\Entity\VisibilityResolved\AccountGroupProductVisibilityResolved
    oro_account.entity.product_visibility_resolved.class: Oro\Bundle\AccountBundle\Entity\VisibilityResolved\ProductVisibilityResolved

services:
    oro_account.security.account_user_provider:
        class: 'Oro\Bundle\AccountBundle\Security\AccountUserProvider'
        public: false
        arguments:
            - "@oro_security.security_facade"
            - "@oro_security.acl.manager"
        calls:
            - [setAccountUserClass, ['%oro_account.entity.account_user.class%']]

    oro_account.acl.voter.account:
        class: 'Oro\Bundle\AccountBundle\Acl\Voter\AccountVoter'
        public: false
        arguments:
            - "@oro_entity.doctrine_helper"
        calls:
            - [setContainer, ["@service_container"]]
        tags:
            - { name: security.voter }

    oro_account.acl.voter.account_group:
        class: 'Oro\Bundle\AccountBundle\Acl\Voter\AccountGroupVoter'
        public: false
        arguments:
            - "@oro_entity.doctrine_helper"
        calls:
            - [setClassName, ["%oro_account.entity.account_group.class%"]]
            - [setConfigManager, ["@oro_config.global"]]
        tags:
            - { name: security.voter }

    oro_product_visibility.acl.voter.account:
        class: 'Oro\Bundle\AccountBundle\Acl\Voter\ProductVisibilityVoter'
        public: false
        arguments:
            - "@oro_entity.doctrine_helper"
        calls:
            - [setClassName, ['%oro_product.entity.product.class%']]
            - [setModifier, ["@oro_account.model.product_visibility_query_builder_modifier"]]
            - [setFrontendHelper, ["@oro_frontend.request.frontend_helper"]]
        tags:
            - { name: security.voter }

    oro_account.event_listener.datagrid.account:
        class: 'Oro\Bundle\AccountBundle\EventListener\Datagrid\AccountDatagridListener'
        arguments:
            - "@oro_account.security.account_user_provider"
            - ["@oro_account.datagrid.account_action_permission_provider", "getActions"]
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before, method: onBuildBeforeFrontendItems }

    oro_account.account_tree_handler:
        class: 'Oro\Bundle\AccountBundle\JsTree\AccountTreeHandler'
        arguments:
            - '%oro_account.entity.account.class%'
            - "@doctrine"

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

    oro_account.manager.group.api.attribute:
        class:  'Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager'
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '%oro_account.entity.account_group.class%'
            - "@doctrine.orm.entity_manager"

    oro_account.form.autocomplete.account_group.search_handler:
        public: false
        parent: oro_form.autocomplete.search_handler
        arguments:
            - '%oro_account.entity.account_group.class%'
            - ["name"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_account_group, acl_resource: oro_account_group_view }

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

    oro_account.form.autocomplete.account_parent.search_handler:
        public: false
        parent: oro_form.autocomplete.search_handler
        class: 'Oro\Bundle\AccountBundle\Autocomplete\ParentAccountSearchHandler'
        arguments:
            - '%oro_account.entity.account.class%'
            - ["name"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_account_parent, acl_resource: oro_account_view }

    oro_account.form.autocomplete.account_user_account.search_handler:
        public: false
        parent: oro_form.autocomplete.search_handler
        class: 'Oro\Bundle\AccountBundle\Autocomplete\AccountAccountUserSearchHandler'
        arguments:
            - '%oro_account.entity.account_user.class%'
            - ["firstname", "lastname"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_account_account_user, acl_resource: oro_account_account_user_view }

    oro_account.frontend_form.autocomplete.account_user_account.search_handler:
        public: false
        parent: oro_form.autocomplete.search_handler
        class: 'Oro\Bundle\AccountBundle\Autocomplete\AccountAccountUserSearchHandler'
        arguments:
            - '%oro_account.entity.account_user.class%'
            - ["firstname", "lastname"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_account_frontend_account_user, acl_resource: oro_account_frontend_account_user_view }

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

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

    oro_account.datagrid.action_permission_provider:
        class: 'Oro\Bundle\AccountBundle\Datagrid\ActionPermissionProvider'
        arguments:
            - "@oro_security.security_facade"

    oro_account.datagrid.account_action_permission_provider:
        class: 'Oro\Bundle\AccountBundle\Datagrid\AccountActionPermissionProvider'
        public: false
        arguments:
            - "@oro_security.security_facade"
            - "@doctrine"

    oro_account.datagrid.extension.accoun_user:
        class: 'Oro\Bundle\AccountBundle\Datagrid\Extension\AccountUserExtension'
        public: false
        calls:
            - [setContainer, ["@service_container"]]
        tags:
            - { name: oro_datagrid.extension }

    oro_account.datagrid.extension.accoun_user_by_account:
        class: 'Oro\Bundle\AccountBundle\Datagrid\Extension\AccountUserByAccountExtension'
        public: false
        calls:
            - [setRequestStack, ["@request_stack"]]
        tags:
            - { name: oro_datagrid.extension }

    oro_account.mailer.processor:
        class: 'Oro\Bundle\AccountBundle\Mailer\Processor'
        arguments:
            - "@doctrine"
            - "@oro_config.manager"
            - "@oro_email.email_renderer"
            - "@oro_email.email_holder_helper"
            - "@oro_email.direct_mailer"

    oro_account_user.manager:
        class: 'Oro\Bundle\AccountBundle\Entity\AccountUserManager'
        arguments:
            - '%oro_account.entity.account_user.class%'
            - "@doctrine"
            - "@security.encoder_factory"
        calls:
            - [setContainer, ["@service_container"]]

    oro_account.security.provider:
        class: '%oro_user.security.provider.class%'
        public: false
        arguments:
            - "@oro_account_user.manager"

    oro_account_user.security.provider:
        class: '%oro_user.security.provider.class%'
        public: false
        arguments:
            - "@oro_account_user.manager"

    oro_account.account_user_menu:
        class: 'Oro\Bundle\AccountBundle\Menu\AccountUserMenuBuilder'
        public: false
        tags:
            - { name: oro_menu.builder, alias: account_usermenu }

    oro_account.placeholder.filter:
        class: 'Oro\Bundle\AccountBundle\Placeholder\PlaceholderFilter'
        arguments:
            - "@oro_security.security_facade"

    oro_account.account_user.password.handler.abstract:
        class: 'Oro\Bundle\AccountBundle\Form\Handler\AbstractAccountUserPasswordHandler'
        abstract: true
        arguments:
            - "@oro_account_user.manager"
            - "@translator"

    oro_account.account_user.password_request.handler:
        class: 'Oro\Bundle\AccountBundle\Form\Handler\AccountUserPasswordRequestHandler'
        parent: oro_account.account_user.password.handler.abstract

    oro_account.account_user.password_reset.handler:
        class: 'Oro\Bundle\AccountBundle\Form\Handler\AccountUserPasswordResetHandler'
        parent: oro_account.account_user.password.handler.abstract

    oro_account.event_listener.form_view:
        class: 'Oro\Bundle\AccountBundle\Form\EventListener\FormViewListener'
        arguments:
            - "@translator"
            - "@oro_entity.doctrine_helper"
            - "@request_stack"
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.category-edit, method: onCategoryEdit }

    oro_account.acl.voter.account_user_role:
        class: 'Oro\Bundle\AccountBundle\Acl\Voter\AccountUserRoleVoter'
        public: false
        arguments:
            - "@oro_entity.doctrine_helper"
        calls:
            - [setContainer, ["@service_container"]]
            - [setClassName, ['%oro_account.entity.account_user_role.class%']]
        tags:
            - { name: security.voter, priority: 10 }

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

    oro_account.event_listener.login:
        class: 'Oro\Bundle\AccountBundle\EventListener\LoginListener'
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method: onSecurityInteractiveLogin }

    oro_account.acl.group_provider:
        class: 'Oro\Bundle\AccountBundle\Acl\Group\AclGroupProvider'
        public: false
        calls:
            - [setContainer, ["@service_container"]]
        tags:
            - { name: oro_security.acl.group_provider, alias: frontend_group }

    oro_account.acl.resolver.role_translation_prefix:
        class: 'Oro\Bundle\AccountBundle\Acl\Resolver\RoleTranslationPrefixResolver'
        arguments:
            - "@oro_security.security_facade"

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

    oro_account.event_listener.datagrid.account_user_role:
        class: 'Oro\Bundle\AccountBundle\EventListener\Datagrid\AccountUserRoleDatagridListener'
        arguments:
            - "@oro_security.security_facade"
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.frontend-account-account-user-roles-grid, method: onBuildBefore }

    oro_account.event_listener.datagrid.account_user:
        class: 'Oro\Bundle\AccountBundle\EventListener\Datagrid\AccountUserDatagridListener'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.account-account-users-grid-update-basic, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.frontend-account-account-users-grid-update, method: onBuildBefore }

    oro_account.twig.security_extension:
        class: 'Oro\Bundle\AccountBundle\Twig\AccountExtension'
        public: false
        arguments:
            - "@oro_account.security.account_user_provider"
        tags:
            - { name: twig.extension }

    oro_account.event_listener.system_config:
        class: 'Oro\Bundle\AccountBundle\EventListener\SystemConfigListener'
        arguments:
            - "@doctrine"
            - '%oro_user.entity.class%'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: onFormPreSetData }
            - { name: kernel.event_listener, event: oro_config.settings_before_save, method: onSettingsSaveBefore }

    oro_frontend.listener.ormdatasource_acl:
        class: 'Oro\Bundle\AccountBundle\EventListener\OrmDatasourceAclListener'
        arguments:
            - "@oro_security.security_facade"
            - "@oro_account.owner.frontend_ownership_metadata_provider"
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before, method: onResultBefore, priority: 100 }

    oro_account.item.builder.pinbar:
        class: 'Oro\Bundle\NavigationBundle\Entity\Builder\PinbarTabBuilder'
        public: false
        arguments:
            - "@doctrine.orm.entity_manager"
        calls:
            - [ setClassName, ['%oro_account.entity.pinbar_tab.class%']]
            - [ setNavigationItemClassName, ['%oro_account.entity.navigation_item.class%']]
        tags:
            - { name: oro_navigation.item.builder, alias: frontend_pinbar }

    oro_account.item.builder.favorite:
        class: 'Oro\Bundle\NavigationBundle\Entity\Builder\NavigationItemBuilder'
        public: false
        arguments:
            - "@doctrine.orm.entity_manager"
        calls:
            - [ setClassName, ['%oro_account.entity.navigation_item.class%']]
        tags:
            - { name: oro_navigation.item.builder, alias: frontend_favorite }

    oro_account.pinbar_menu.builder:
        class: 'Oro\Bundle\NavigationBundle\Menu\NavigationItemBuilder'
        public: false
        arguments:
            - "@security.context"
            - "@doctrine.orm.entity_manager"
            - "@oro_navigation.item.factory"
        tags:
            - { name: oro_menu.builder, alias: frontend_pinbar }

    oro_account.favorites_menu.builder:
        class: 'Oro\Bundle\NavigationBundle\Menu\NavigationItemBuilder'
        public: false
        arguments:
            - "@security.context"
            - "@doctrine.orm.entity_manager"
            - "@oro_navigation.item.factory"
        tags:
            - { name: oro_menu.builder, alias: frontend_favorite }

    oro_account.history_menu.builder:
        class: 'Oro\Bundle\NavigationBundle\Menu\NavigationHistoryBuilder'
        public: false
        arguments:
            - "@security.context"
            - "@doctrine.orm.entity_manager"
            - "@oro_navigation.item.factory"
        calls:
            - [ setMatcher, [ "@knp_menu.matcher" ]]
            - [ setOptions, [ "@oro_config.user" ]]
        tags:
            - { name: oro_menu.builder, alias: frontend_history }

    oro_account.mostviewed_menu.builder:
        class: 'Oro\Bundle\NavigationBundle\Menu\NavigationMostviewedBuilder'
        public: false
        arguments:
            - "@security.context"
            - "@doctrine.orm.entity_manager"
            - "@oro_navigation.item.factory"
        calls:
            - [ setOptions, [ "@oro_config.user" ]]
        tags:
            - { name: oro_menu.builder, alias: frontend_mostviewed }

    oro_account.item.pinbar.post_persist_listener:
        class: 'Oro\Bundle\NavigationBundle\Entity\Listener\PinbarPostPersist'
        public: false
        calls:
            - [ setClassName, ['%oro_account.entity.pinbar_tab.class%']]
        tags:
            - { name: doctrine.event_listener, event: postPersist }

    kernel.listener.frontend_nav_history_response:
        class: '%oro_navigation.event.response_history.listener.class%'
        tags:
            - { name: kernel.event_listener, event: kernel.response, method: onResponse }
        arguments:
            - "@oro_navigation.item.factory"
            - "@security.context"
            - "@doctrine"
            - "@oro_navigation.title_service"
        calls:
            - [ setHistoryItemEntityFQCN, ['%oro_account.entity.navigation_history_item.class%']]
            - [ setUserEntityFQCN, ['%oro_account.entity.account_user.class%']]
            - [ setNavigationHistoryItemType, ['frontend_history']]

    oro_account.item.builder.history:
        class: 'Oro\Bundle\NavigationBundle\Entity\Builder\HistoryItemBuilder'
        public: false
        arguments:
            - "@doctrine.orm.entity_manager"
        calls:
            - [ setClassName, ['%oro_account.entity.navigation_history_item.class%']]
        tags:
            - { name: oro_navigation.item.builder, alias: frontend_history }

    oro_account.item.builder.mostviewed:
        class: 'Oro\Bundle\NavigationBundle\Entity\Builder\HistoryItemBuilder'
        public: false
        arguments:
            - "@doctrine.orm.entity_manager"
        calls:
            - [ setClassName, ['%oro_account.entity.navigation_history_item.class%']]
        tags:
            - { name: oro_navigation.item.builder, alias: frontend_mostviewed }

    oro_account.content_provider.menu.history_menu:
        class: 'Oro\Bundle\NavigationBundle\ContentProvider\MenuContentProvider'
        public: false
        arguments:
            - "@oro_menu.twig.extension"
            - "frontend_history"
            - "frontend_history"
        tags:
            - { name: oro_ui.content_provider }

    oro_account.content_provider.menu.mostviewed_menu:
        class: 'Oro\Bundle\NavigationBundle\ContentProvider\MenuContentProvider'
        public: false
        arguments:
            - "@oro_menu.twig.extension"
            - "frontend_mostviewed"
            - "frontend_mostviewed"
        tags:
            - { name: oro_ui.content_provider }

    oro_account.event_listener.visibility_grid_listener:
        class: 'Oro\Bundle\AccountBundle\EventListener\VisibilityGridListener'
        arguments:
            - "@doctrine"
            - "@oro_account.provider.visibility_choices"
        calls:
            - [ addSubscribedGridConfig, { datagrid: account-group-category-visibility-grid, visibilityEntityClass: '%oro_account.entity.account_group_category_visibility.class%', targetEntityClass: '%oro_catalog.entity.category.class%' }]
            - [ addSubscribedGridConfig, { datagrid: account-category-visibility-grid, visibilityEntityClass: '%oro_account.entity.account_category_visibility.class%', targetEntityClass: '%oro_catalog.entity.category.class%' }]
            - [ addSubscribedGridConfig, { datagrid: account-group-product-visibility-grid, visibilityEntityClass: '%oro_account.entity.account_group_product_visibility.class%', targetEntityClass: '%oro_product.entity.product.class%' }]
            - [ addSubscribedGridConfig, { datagrid: account-product-visibility-grid, visibilityEntityClass: '%oro_account.entity.account_product_visibility.class%', targetEntityClass: '%oro_product.entity.product.class%' }]
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.account-category-visibility-grid, method: onPreBuild }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.account-group-category-visibility-grid, method: onPreBuild }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before.account-category-visibility-grid, method: onResultBefore }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before.account-group-category-visibility-grid, method: onResultBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.account-product-visibility-grid, method: onPreBuild }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.account-group-product-visibility-grid, method: onPreBuild }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before.account-product-visibility-grid, method: onResultBefore }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before.account-group-product-visibility-grid, method: onResultBefore }

    oro_account.event_listener.product_duplicate_listener:
        class: 'Oro\Bundle\AccountBundle\EventListener\ProductDuplicateListener'
        arguments:
            - "@doctrine"
        tags:
            - { name: kernel.event_listener, event: oro_product.product.duplicate.after, method: onDuplicateProduct }
        calls:
            - [ setVisibilityToAllClassName, ['%oro_account.entity.product_visibility.class%'] ]
            - [ setVisibilityAccountGroupClassName, ['%oro_account.entity.account_group_product_visibility.class%'] ]
            - [ setVisibilityAccountClassName, ['%oro_account.entity.account_product_visibility.class%'] ]
            - [ setFieldName, ['product'] ]

    oro_account.event_listener.default_visibility:
        class: 'Oro\Bundle\AccountBundle\EventListener\DefaultVisibilityListener'
        public: false
        tags:
            - { name: doctrine.event_listener, event: onFlush }

    oro_account.form.event_listener.category_visibility_post_submit:
        class: 'Oro\Bundle\AccountBundle\Form\EventListener\CategoryVisibilityPostSubmitListener'
        parent: oro_account.form.event_listener.abstract_visibility_post_submit
        tags:
            - { name: kernel.event_listener, event: oro_catalog.category.edit, method: onPostSubmit }

    oro_account.form.event_listener.product_visibility_post_submit:
        class: 'Oro\Bundle\AccountBundle\Form\EventListener\ProductVisibilityPostSubmitListener'
        parent: oro_account.form.event_listener.abstract_visibility_post_submit
        tags:
            - { name: kernel.event_listener, event: oro_product.product.edit, method: onPostSubmit }

    oro_account.account_delete_handler:
        class: 'Oro\Bundle\AccountBundle\Handler\UserDeleteHandler'
        arguments:
            - "@oro_security.security_facade"

    oro.account.catalog.visibility.change_set.validatior:
        class: 'Oro\Bundle\AccountBundle\Validator\Constraints\VisibilityChangeSetValidator'
        tags:
            - { name: validator.constraint_validator, alias: oro.account.catalog.visibility.change_set.validatior }

    oro_account.provider.visibility_choices:
        class: 'Oro\Bundle\AccountBundle\Provider\VisibilityChoicesProvider'
        public: false
        arguments:
            - "@translator"
            - "@doctrine"

    oro_account.audit.discriminator_map_listener:
        class: 'Oro\Bundle\AccountBundle\Audit\DiscriminatorMapListener'
        public: false
        calls:
            - [ addClass, ['oro_audit', '%oro_account.entity.audit.class%'] ]
        tags:
            - { name: doctrine.event_listener, event: loadClassMetadata }

    oro_account.visibility.resolver.category_visibility_resolver:
        class: 'Oro\Bundle\AccountBundle\Visibility\Resolver\CategoryVisibilityResolver'
        arguments:
            - "@doctrine"
            - "@oro_config.manager"

    oro_account.event_listener.category_tree_handler_listener:
        class: 'Oro\Bundle\AccountBundle\EventListener\CategoryTreeHandlerListener'
        arguments:
            - "@oro_account.visibility.resolver.category_visibility_resolver"
            - "@oro_account.provider.account_user_relations_provider"
        tags:
            - {name: kernel.event_listener, event: oro_catalog.category.tree.create_after, method: onCreateAfter }

    oro_account.event_listener.frontend_dataaudit_history_grid_listener:
        class: '%oro_dataaudit.event_listener.dataaudit_history_grid_listener.class%'
        arguments:
            - [objectClass, objectId]
        tags:
          - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.frontend-audit-history-grid, method: onBuildAfter }

    oro_account.model.product_visibility_query_builder_modifier:
        class: 'Oro\Bundle\AccountBundle\Model\ProductVisibilityQueryBuilderModifier'
        public: false
        arguments:
            - "@oro_config.global"
            - "@security.token_storage"
            - "@oro_website.manager"
            - "@oro_account.provider.account_user_relations_provider"
        calls:
            - [setProductVisibilitySystemConfigurationPath, ['oro_account.product_visibility']]
            - [setCategoryVisibilitySystemConfigurationPath, ['oro_account.category_visibility']]

    oro_account.visibility.cache.product.cache_builder.abstract:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\AbstractResolvedCacheBuilder'
        public: false
        abstract: true
        arguments:
            - "@doctrine"
            - "@oro_entity.orm.insert_from_select_query_executor"

    oro_account.visibility.cache.product.account_group_product_resolved_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\AccountGroupProductResolvedCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.cache_builder.abstract
        calls:
            - [setCacheClass, ['%oro_account.entity.account_group_product_visibility_resolved.class%']]

    oro_account.visibility.cache.product.account_product_resolved_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\AccountProductResolvedCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.cache_builder.abstract
        calls:
            - [setCacheClass, ['%oro_account.entity.account_product_visibility_resolved.class%']]

    oro_account.visibility.cache.product.product_resolved_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\ProductResolvedCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.cache_builder.abstract
        calls:
            - [setCacheClass, ['%oro_account.entity.product_visibility_resolved.class%']]

    oro_account.visibility.cache.product.cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\CacheBuilder'
        calls:
            - [addBuilder, ["@oro_account.visibility.cache.product.product_resolved_cache_builder"]]
            - [addBuilder, ["@oro_account.visibility.cache.product.account_group_product_resolved_cache_builder"]]
            - [addBuilder, ["@oro_account.visibility.cache.product.account_product_resolved_cache_builder"]]

    oro_account.visibility.cache.product.category.account_group_category_resolved_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\AccountGroupCategoryResolvedCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.cache_builder.abstract
        calls:
            - [setCacheClass, ['%oro_account.entity.account_group_category_visibility_resolved.class%']]
            - [setVisibilityChangeAccountSubtreeCacheBuilder, ["@oro_account.visibility.cache.product.category.subtree.visibility_change_group_subtree_cache_builder"]]

    oro_account.visibility.cache.product.category.account_category_resolved_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\AccountCategoryResolvedCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.cache_builder.abstract
        calls:
            - [setCacheClass, ['%oro_account.entity.account_category_visibility_resolved.class%']]
            - [setVisibilityChangeAccountSubtreeCacheBuilder, ["@oro_account.visibility.cache.product.category.subtree.visibility_change_account_subtree_cache_builder"]]

    oro_account.visibility.cache.product.category.category_resolved_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\CategoryResolvedCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.cache_builder.abstract
        calls:
            - [setCacheClass, ['%oro_account.entity.category_visibility_resolved.class%']]
            - [setVisibilityChangeCategorySubtreeCacheBuilder, ["@oro_account.visibility.cache.product.category.subtree.visibility_change_category_subtree_cache_builder"]]
            - [setPositionChangeCategorySubtreeCacheBuilder, ["@oro_account.visibility.cache.product.category.subtree.position_change_category_subtree_cache_builder"]]

    oro_account.visibility.cache.product.category.cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\CacheBuilder'
        calls:
            - [addBuilder, ["@oro_account.visibility.cache.product.category.category_resolved_cache_builder"]]
            - [addBuilder, ["@oro_account.visibility.cache.product.category.account_group_category_resolved_cache_builder"]]
            - [addBuilder, ["@oro_account.visibility.cache.product.category.account_category_resolved_cache_builder"]]

    oro_account.visibility.cache.cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\CompositeCacheBuilder'
        calls:
            - [addBuilder, ["@oro_account.visibility.cache.product.category.cache_builder"]]
            - [addBuilder, ["@oro_account.visibility.cache.product.cache_builder"]]

    oro_account.visibility.cache.product.category.subtree.category_subtree_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\Subtree\AbstractSubtreeCacheBuilder'
        abstract: true
        arguments:
            - "@doctrine"
            - "@oro_account.visibility.resolver.category_visibility_resolver"
            - "@oro_config.manager"

    oro_account.visibility.cache.product.category.subtree.visibility_change_category_subtree_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\Subtree\VisibilityChangeCategorySubtreeCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.category.subtree.category_subtree_cache_builder

    oro_account.visibility.cache.product.category.subtree.position_change_category_subtree_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\Subtree\PositionChangeCategorySubtreeCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.category.subtree.category_subtree_cache_builder

    oro_account.visibility.cache.product.category.subtree.visibility_change_account_subtree_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\Subtree\VisibilityChangeAccountSubtreeCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.category.subtree.category_subtree_cache_builder

    oro_account.visibility.cache.product.category.subtree.visibility_change_group_subtree_cache_builder:
        class: 'Oro\Bundle\AccountBundle\Visibility\Cache\Product\Category\Subtree\VisibilityChangeGroupSubtreeCacheBuilder'
        public: false
        parent: oro_account.visibility.cache.product.category.subtree.category_subtree_cache_builder

    oro_account.event_listener.product_select_db_query:
        class: 'Oro\Bundle\AccountBundle\EventListener\ProductSelectDBQueryEventListener'
        arguments:
            - "@oro_frontend.request.frontend_helper"
            - "@oro_account.model.product_visibility_query_builder_modifier"
        tags:
            - { name: kernel.event_listener, event: oro_product.product_select.db.query, method: onDBQuery }

    oro_account.entity.entity_listener.category_listener:
        class: 'Oro\Bundle\AccountBundle\Entity\EntityListener\CategoryListener'
        public: false
        arguments:
            - "@oro_catalog.model.category_message_handler"
        tags:
            - { name: doctrine.orm.entity_listener, entity: '%oro_catalog.entity.category.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_catalog.entity.category.class%', event: postRemove }

    oro_account.event_listener.category_listener:
        class: 'Oro\Bundle\AccountBundle\EventListener\CategoryListener'
        public: false
        arguments:
            - '@oro_product.model.product_message_handler'
        tags:
            - { name: doctrine.event_listener, event: onFlush }

    oro_account.provider.frontend_account_user_registration_form:
        class: 'Oro\Bundle\AccountBundle\Layout\DataProvider\FrontendAccountUserRegistrationFormProvider'
        arguments:
            - "@form.factory"
            - "@doctrine"
            - "@oro_config.manager"
            - "@oro_website.manager"
            - "@oro_user.manager"
        tags:
            - { name: layout.data_provider, alias: oro_account_frontend_account_user_register }

    oro_account.manager.windows_state:
        parent: oro_windows.manager.windows_state.abstract
        arguments:
            - '%oro_account.entity.windows_state.class%'
            - '%oro_account.entity.account_user.class%'

    oro_account.provider.sign_in:
        class: 'Oro\Bundle\AccountBundle\Layout\DataProvider\SignInProvider'
        arguments:
            - "@request_stack"
            - "@oro_security.security_facade"
            - "@security.csrf.token_manager"
        tags:
            - { name: layout.data_provider, alias: oro_account_sign_in }

    oro_account.doctrine.filters_listener:
        class: 'Oro\Bundle\AccountBundle\Doctrine\DoctrineFiltersListener'
        arguments:
            - "@doctrine"
            - "@oro_frontend.request.frontend_helper"
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onRequest }

    oro_account.provider.frontend_account_user_role_form:
        class: 'Oro\Bundle\AccountBundle\Layout\DataProvider\FrontendAccountUserRoleFormProvider'
        arguments:
            - '@form.factory'
            - '@oro_account.form.handler.update_account_user_role_frontend='
        tags:
            - { name: layout.data_provider, alias: oro_account_frontend_account_user_role_form }

    oro_account.provider.fronted_account_user_address_form:
        class: Oro\Bundle\AccountBundle\Layout\DataProvider\FrontendAccountUserAddressFormProvider
        arguments:
            - '@form.factory'
        tags:
            - { name: layout.data_provider, alias: oro_account_frontend_account_user_address_form }

    oro_account.provider.frontend_account_address_form:
        class: Oro\Bundle\AccountBundle\Layout\DataProvider\FrontendAccountAddressFormProvider
        arguments:
            - '@form.factory'
        tags:
            - { name: layout.data_provider, alias: oro_account_frontend_account_address_form }

    oro_account.provider.frontend_account_user_form:
        class: 'Oro\Bundle\AccountBundle\Layout\DataProvider\FrontendAccountUserFormProvider'
        arguments:
              - '@form.factory'
        tags:
            - { name: layout.data_provider, alias: oro_account_frontend_account_user_form }

    oro_account.provider.account_user_relations_provider:
        class: 'Oro\Bundle\AccountBundle\Provider\AccountUserRelationsProvider'
        arguments:
            - '@oro_config.global'
            - '@oro_entity.doctrine_helper'

    oro_account.provider.fronted_account_user_role_tabs_options:
        class: 'Oro\Bundle\AccountBundle\Layout\DataProvider\FrontendAccountUserRoleOptionsProvider'
        arguments:
            - '@oro_user.provider.role_privilege_capability_provider'
            - '@oro_user.provider.role_privilege_category_provider'
            - '@translator'
        tags:
            - { name: layout.data_provider, alias: oro_account_fronted_account_user_role_options }

    oro_account.datagrid.datasource.account_role_frontend_permission_datasource:
        class: 'Oro\Bundle\AccountBundle\Datagrid\RolePermissionDatasource'
        arguments:
            - '@translator'
            - '@oro_security.acl.permission_manager'
            - '@oro_account.form.handler.update_account_user_role_frontend='
            - '@oro_user.provider.role_privilege_category_provider'
            - '@oro_entity_config.config_manager'
            - '@oro_account.acl.resolver.role_translation_prefix'
        tags:
            - { name: oro_datagrid.datasource, type: account-role-frontend-permission-provider }

    oro_account.datagrid.datasource.account_role_permission_datasource:
        class: 'Oro\Bundle\AccountBundle\Datagrid\RolePermissionDatasource'
        arguments:
            - '@translator'
            - '@oro_security.acl.permission_manager'
            - '@oro_account.form.handler.update_account_user_role='
            - '@oro_user.provider.role_privilege_category_provider'
            - '@oro_entity_config.config_manager'
            - '@oro_account.acl.resolver.role_translation_prefix'
        tags:
            - { name: oro_datagrid.datasource, type: account-role-permission-provider }

    oro_account.layout.data_provider.address_provider_abstract:
        class: Oro\Bundle\AccountBundle\Layout\DataProvider\AddressProvider
        arguments:
            - '@router'
            - '@fragment.handler'

    oro_account.layout.data_provider.account_address_provider:
        parent: oro_account.layout.data_provider.address_provider_abstract
        calls:
            - [setEntityClass, ['Oro\Bundle\AccountBundle\Entity\Account']]
            - [setListRouteName, ['oro_api_account_frontend_get_account_addresses']]
            - [setCreateRouteName, ['oro_account_frontend_account_address_create']]
            - [setUpdateRouteName, ['oro_account_frontend_account_address_update']]
        tags:
             - { name: layout.data_provider, alias: account_address_provider }

    oro_account.layout.data_provider.account_user_address_provider:
        parent: oro_account.layout.data_provider.address_provider_abstract
        calls:
            - [setEntityClass, ['Oro\Bundle\AccountBundle\Entity\AccountUser']]
            - [setListRouteName, ['oro_api_account_frontend_get_accountuser_addresses']]
            - [setCreateRouteName, ['oro_account_frontend_account_user_address_create']]
            - [setUpdateRouteName, ['oro_account_frontend_account_user_address_update']]
        tags:
             - { name: layout.data_provider, alias: account_user_address_provider }

    oro_account.visibility_message_factory:
        class: 'Oro\Bundle\AccountBundle\Model\VisibilityMessageFactory'
        arguments:
            - '@doctrine'

    oro_account.product_visibility_message_factory:
        class: 'Oro\Bundle\AccountBundle\Model\ProductVisibilityMessageFactory'
        arguments:
            - '@doctrine'

    oro_account.category_visibility_message_factory:
        class: 'Oro\Bundle\AccountBundle\Model\CategoryVisibilityMessageFactory'
        arguments:
            - '@doctrine'

    oro_account.visibility_message_handler:
        class: 'Oro\Bundle\AccountBundle\Model\VisibilityMessageHandler'
        arguments:
            - '@oro_account.visibility_message_factory'
            - '@oro_message_queue.client.message_producer'
        tags:
            - { name: kernel.event_listener, event: kernel.terminate, method: sendScheduledMessages }

    oro_account.product_visibility_message_handler:
        class: 'Oro\Bundle\AccountBundle\Model\VisibilityMessageHandler'
        arguments:
            - '@oro_account.product_visibility_message_factory'
            - '@oro_message_queue.client.message_producer'
        tags:
            - { name: kernel.event_listener, event: kernel.terminate, method: sendScheduledMessages }

    oro_account.category_visibility_message_handler:
        class: 'Oro\Bundle\AccountBundle\Model\VisibilityMessageHandler'
        arguments:
            - '@oro_account.category_visibility_message_factory'
            - '@oro_message_queue.client.message_producer'
        tags:
            - { name: kernel.event_listener, event: kernel.terminate, method: sendScheduledMessages }

    oro_account.entity_listener.abstract_visibility_listener:
        class: 'Oro\Bundle\AccountBundle\Entity\EntityListener\AbstractAffectVisibilityListener'
        abstract: true
        public: false
        arguments:
            - '@oro_account.visibility_message_handler'

    oro_account.entity_listener.product_visibility_change:
        class: 'Oro\Bundle\AccountBundle\Entity\EntityListener\ProductVisibilityListener'
        public: false
        arguments:
            - '@oro_account.product_visibility_message_handler'
        calls:
            - [setTopic, ['oro_account.visibility.resolve_product_visibility']]
        tags:
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.product_visibility.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.product_visibility.class%', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.product_visibility.class%', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_product_visibility.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_product_visibility.class%', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_group_product_visibility.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_group_product_visibility.class%', event: postPersist }

    oro_account.entity_listener.category_visibility_change:
        class: 'Oro\Bundle\AccountBundle\Entity\EntityListener\CategoryVisibilityListener'
        public: false
        arguments:
            - '@oro_account.category_visibility_message_handler'
        calls:
            - [setTopic, ['oro_account.visibility.change_category_visibility']]
        tags:
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.category_visibility.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.category_visibility.class%', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.category_visibility.class%', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_group_category_visibility.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_group_category_visibility.class%', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_group_category_visibility.class%', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_category_visibility.class%', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_category_visibility.class%', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: '%oro_account.entity.account_category_visibility.class%', event: postPersist }

    oro_account.entity_listener.change_product_category:
        class: 'Oro\Bundle\AccountBundle\Entity\EntityListener\ProductListener'
        public: false
        parent: oro_account.entity_listener.abstract_visibility_listener
        calls:
            - [setTopic, ['oro_account.visibility.change_product_category']]
        tags:
            - { name: doctrine.orm.entity_listener, entity: '%oro_product.entity.product.class%', event: postPersist }

    oro_account.async.visibility.product_visibility_processor:
        class: Oro\Bundle\AccountBundle\Async\Visibility\ProductVisibilityProcessor
        arguments:
            - '@doctrine'
            - '@oro_account.product_visibility_message_factory'
            - '@logger'
            - '@oro_account.visibility.cache.product.cache_builder'
            - '@oro_entity.database_exception_helper'
        calls:
            - [setResolvedVisibilityClassName, ['%oro_account.entity.account_product_visibility_resolved.class%']]
        tags:
            - { name: 'oro_message_queue.client.message_processor', topicName: 'oro_account.visibility.resolve_product_visibility' }

    oro_account.async.visibility.category_visibility_processor:
        class: Oro\Bundle\AccountBundle\Async\Visibility\CategoryVisibilityProcessor
        arguments:
            - '@doctrine'
            - '@oro_account.category_visibility_message_factory'
            - '@logger'
            - '@oro_account.visibility.cache.product.category.cache_builder'
            - '@oro_entity.database_exception_helper'
            - '@oro_product.model.product_message_handler'
        calls:
            - [setResolvedVisibilityClassName, ['%oro_account.entity.category_visibility_resolved.class%']]
        tags:
            - { name: 'oro_message_queue.client.message_processor', topicName: 'oro_account.visibility.change_category_visibility' }

    oro_account.async.visibility.product_processor:
        class: Oro\Bundle\AccountBundle\Async\Visibility\ProductProcessor
        arguments:
            - '@doctrine'
            - '@oro_product.model.product_message_factory'
            - '@logger'
            - '@oro_account.visibility.cache.product.cache_builder'
            - '@oro_entity.database_exception_helper'
        calls:
            - [setResolvedVisibilityClassName, ['%oro_account.entity.account_product_visibility_resolved.class%']]
        tags:
            - { name: 'oro_message_queue.client.message_processor', topicName: 'oro_account.visibility.change_product_category' }

    oro_account.async.category_processor:
        class: Oro\Bundle\AccountBundle\Async\Visibility\CategoryProcessor
        arguments:
            - '@doctrine'
            - '@oro_entity.orm.insert_from_select_query_executor'
            - '@logger'
            - '@oro_catalog.model.category_message_factory'
            - '@oro_account.visibility.cache.product.category.cache_builder'
            - '@oro_entity.database_exception_helper'
        tags:
            - { name: oro_message_queue.client.message_processor, topicName: 'oro_account.visibility.category_remove' }
            - { name: oro_message_queue.client.message_processor, topicName: 'oro_account.visibility.category_position_change' }
