parameters:
    kunstmaan_admin.menubuilder.class: 'Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder'
    kunstmaan_admin.admin_panel.class: 'Kunstmaan\AdminBundle\Helper\AdminPanel\AdminPanel'
    kunstmaan_admin.login.listener.class: 'Kunstmaan\AdminBundle\EventListener\LoginListener'
    kunstmaan_admin.admin_locale.listener.class: 'Kunstmaan\AdminBundle\EventListener\AdminLocaleListener'
    kunstmaan_admin.acl.helper.class: 'Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper'
    kunstmaan_admin.acl.native.helper.class: 'Kunstmaan\AdminBundle\Helper\Security\Acl\AclNativeHelper'
    kunstmaan_admin.security.acl.permission.map.class: 'Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionMap'
    kunstmaan_admin.clone.listener.class: 'Kunstmaan\AdminBundle\EventListener\CloneListener'
    kunstmaan_admin.session_security.class: 'Kunstmaan\AdminBundle\EventListener\SessionSecurityListener'
    kunstmaan_admin.password_resetting.listener.class: 'Kunstmaan\AdminBundle\EventListener\PasswordResettingListener'
    kunstmaan_admin.password_check.listener.class: 'Kunstmaan\AdminBundle\EventListener\PasswordCheckListener'
    kunstmaan_admin.firewall.provider_key: 'main'
    kunstmaan_admin.domain_configuration.class: 'Kunstmaan\AdminBundle\Helper\DomainConfiguration'
    kunstmaan_admin.validator.password_restrictions.class: 'Kunstmaan\AdminBundle\Validator\Constraints\PasswordRestrictionsValidator'
    kunstmaan_admin.adminroute.helper.class: 'Kunstmaan\AdminBundle\Helper\AdminRouteHelper'
    kunstmaan_admin.adminroute.twig.class: 'Kunstmaan\AdminBundle\Twig\AdminRouteHelperTwigExtension'
    kunstmaan_admin.exception.listener.class: 'Kunstmaan\AdminBundle\EventListener\ExceptionSubscriber'
    kunstmaan_admin.toolbar.listener.class: 'Kunstmaan\AdminBundle\EventListener\ToolbarListener'
    kunstmaan_admin.toolbar.collector.bundle.class: 'Kunstmaan\AdminBundle\Toolbar\BundleVersionDataCollector'
    kunstmaan_admin.toolbar.collector.exception.class: 'Kunstmaan\AdminBundle\Toolbar\ExceptionDataCollector'

services:
    kunstmaan_admin.menubuilder:
        class: '%kunstmaan_admin.menubuilder.class%'
        arguments: ['@request_stack']

    kunstmaan_admin.admin_panel:
        class: '%kunstmaan_admin.admin_panel.class%'

    kunstmaan_admin.menu.adaptor.modules:
        class: Kunstmaan\AdminBundle\Helper\Menu\ModulesMenuAdaptor
        tags:
            -  { name: 'kunstmaan_admin.menu.adaptor', priority: 200 }

    kunstmaan_admin.menu.adaptor.settings:
        class: Kunstmaan\AdminBundle\Helper\Menu\SettingsMenuAdaptor
        arguments: ['@security.authorization_checker', "%version_checker.enabled%"]
        tags:
            -  { name: 'kunstmaan_admin.menu.adaptor', priority: 100 }

    kunstmaan_admin.login.listener:
        class: '%kunstmaan_admin.login.listener.class%'
        arguments: ['@kunstmaan_admin.logger', '@kunstmaan_admin.versionchecker', '@kunstmaan_admin.adminroute.helper']
        tags:
            - { name: 'kernel.event_listener', event: 'security.interactive_login' }

    kunstmaan_admin.admin_locale.listener:
        class: '%kunstmaan_admin.admin_locale.listener.class%'
        arguments: ['@security.token_storage', '@translator', '@kunstmaan_admin.adminroute.helper', '%kunstmaan_admin.default_admin_locale%', '%kunstmaan_admin.firewall.provider_key%']
        tags:
            - { name: 'kernel.event_subscriber' }

    kunstmaan_admin.menu.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\MenuTwigExtension
        arguments: ['@kunstmaan_admin.menubuilder', '@kunstmaan_admin.admin_panel']
        tags:
            -  { name: 'twig.extension' }

    kunstmaan_admin.localeswitcher.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\LocaleSwitcherTwigExtension
        arguments: ['@kunstmaan_admin.domain_configuration']
        tags:
            -  { name: 'twig.extension' }

    kunstmaan_admin.multidomain.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\MultiDomainAdminTwigExtension
        arguments: ['@kunstmaan_admin.domain_configuration']
        tags:
              -  { name: 'twig.extension' }

    kunstmaan_admin.locale.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\DateByLocaleExtension
        tags:
            - { name: 'twig.extension' }

    kunstmaan_admin.formtools.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\FormToolsExtension
        arguments: ['@kunstmaan_admin.form.helper']
        tags:
            - { name: 'twig.extension' }

    kunstmaan_admin.permissions.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\AdminPermissionsTwigExtension
        tags:
            -  { name: 'twig.extension' }

    kunstmaan_admin.acl.helper:
        class: '%kunstmaan_admin.acl.helper.class%'
        arguments: ['@doctrine.orm.entity_manager', '@security.token_storage', '@security.role_hierarchy']
        public: true

    kunstmaan_admin.acl.manager:
        class: Kunstmaan\AdminBundle\Service\AclManager
        arguments:
            - '@security.acl.provider'
            - '@security.acl.object_identity_retrieval_strategy'
            - '@doctrine.orm.entity_manager'
            - '@kunstmaan_admin.permissionadmin'
        public: true

    kunstmaan_admin.acl.native.helper:
        class: '%kunstmaan_admin.acl.native.helper.class%'
        arguments: ['@doctrine.orm.entity_manager', '@security.token_storage', '@security.role_hierarchy']

    kunstmaan_admin.security.acl.permission.map:
        class: '%kunstmaan_admin.security.acl.permission.map.class%'

    kunstmaan_admin.security.acl.voter:
        class: Kunstmaan\AdminBundle\Helper\Security\Acl\Voter\AclVoter
        arguments: ['@security.acl.provider', '@security.acl.object_identity_retrieval_strategy', '@security.acl.security_identity_retrieval_strategy', '@kunstmaan_admin.security.acl.permission.map']
        tags:
            - { name: security.voter, priority: 255 }
            - { name: monolog.logger, channel: security }
        # small performance boost
        public: false

    kunstmaan_admin.permissionadmin:
        class: Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionAdmin
        arguments: ['@doctrine.orm.entity_manager', '@security.token_storage', '@security.acl.provider', '@security.acl.object_identity_retrieval_strategy', '@event_dispatcher', '@kunstmaan_utilities.shell', '@kernel']

    kunstmaan_admin.clone.helper:
        class: Kunstmaan\AdminBundle\Helper\CloneHelper
        arguments: ['@doctrine.orm.entity_manager', '@event_dispatcher']
        public: true

    kunstmaan_admin.adminroute.helper:
        class: '%kunstmaan_admin.adminroute.helper.class%'
        arguments: ['%kunstmaan_admin.admin_prefix%', '@request_stack']
        public: true

    kunstmaan_admin.adminroute.twig.extension:
        class: '%kunstmaan_admin.adminroute.twig.class%'
        arguments: ['@kunstmaan_admin.adminroute.helper']
        tags:
            -  { name: 'twig.extension' }

    kunstmaan_admin.clone.listener:
        class: '%kunstmaan_admin.clone.listener.class%'
        tags:
            - { name: kernel.event_listener, event: kunstmaan_admin.onDeepCloneAndSave, method: onDeepCloneAndSave }

    kunstmaan_admin.logger.processor.user:
        class: Kunstmaan\AdminBundle\Helper\UserProcessor
        arguments: [ '@security.token_storage' ]
        tags:
            - { name: monolog.processor, method: processRecord }
            - { name: kunstmaan_admin.logger.processor, method: processRecord }

    kunstmaan_admin.logger.handler:
        class: Monolog\Handler\RotatingFileHandler
        arguments: ['%kernel.logs_dir%/kunstmaan_%kernel.environment%.log', 10]

    kunstmaan_admin.logger:
        class: Symfony\Bridge\Monolog\Logger
        arguments: [kunstmaan]
        calls:
            - [pushHandler, ['@kunstmaan_admin.logger.handler']]

    kunstmaan_admin.form.helper:
        class: Kunstmaan\AdminBundle\Helper\FormHelper

    kunstmaan_admin.tabs.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\TabsTwigExtension
        tags:
            - { name: twig.extension }

    kunstmaan_admin.permission_creator:
        class: Kunstmaan\AdminBundle\Helper\Creators\ACLPermissionCreator
        arguments: ['@security.acl.provider', '@security.acl.object_identity_retrieval_strategy']

    kunstmaan_admin.versionchecker:
        class: Kunstmaan\AdminBundle\Helper\VersionCheck\VersionChecker
        arguments: ['@service_container', '@cache.kunstmaan_versioncheck', '@translator']
        public: true

    kunstmaan_admin.cache:
        class: Doctrine\Common\Cache\FilesystemCache
        arguments: ['%kernel.cache_dir%/fcache']
        deprecated: 'The "%service_id%" service is deprecated since Kunstmaan/AdminBundle 5.7 and will be removed in KunstmaanAdminBundle 6.0.'

    cache.kunstmaan_versioncheck:
        parent: cache.adapter.filesystem
        tags:
            - { name: cache.pool }

    kunstmaan_admin.form.type.color:
        class: Kunstmaan\AdminBundle\Form\ColorType
        tags:
            - { name: form.type }

    kunstmaan_admin.doctrine_mapping.listener:
        class: Kunstmaan\AdminBundle\EventListener\MappingListener
        arguments: ['%fos_user.model.user.class%']
        tags:
            - { name: doctrine.event_listener, event: loadClassMetadata }

    kunstmaan_admin.form.type.range:
        class: Kunstmaan\AdminBundle\Form\RangeType
        tags:
            - { name: form.type }

    kunstmaan_admin.session_security:
        class: '%kunstmaan_admin.session_security.class%'
        arguments: ['%kunstmaan_admin.session_security.ip_check%', '%kunstmaan_admin.session_security.user_agent_check%', '@logger']
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
            - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse, priority: -1000 }

    kunstmaan_form.type.wysiwyg:
        class: Kunstmaan\AdminBundle\Form\WysiwygType
        tags:
            - { name: form.type }

    kunstmaan_admin.password_resetting.listener:
        class: '%kunstmaan_admin.password_resetting.listener.class%'
        arguments: ['@fos_user.user_manager']
        tags:
            - { name: kernel.event_listener, event: fos_user.change_password.edit.completed, method: onPasswordResettingSuccess }

    kunstmaan_admin.password_check.listener:
        class: '%kunstmaan_admin.password_check.listener.class%'
        arguments: ['@security.authorization_checker', '@security.token_storage', '@router.default', '@session', '@translator', '@kunstmaan_admin.adminroute.helper']
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 1 }

    kunstmaan_admin.admin_panel.adaptor:
        class: Kunstmaan\AdminBundle\Helper\AdminPanel\DefaultAdminPanelAdaptor
        arguments: ['@security.token_storage']
        tags:
            -  { name: 'kunstmaan_admin.admin_panel.adaptor' }

    kunstmaan_admin.domain_configuration:
        class: '%kunstmaan_admin.domain_configuration.class%'
        arguments: ['@request_stack', '%kunstmaan_admin.multi_language%', '%kunstmaan_admin.default_locale%', '%kunstmaan_admin.required_locales%']
        public: true

    kunstmaan_admin.oauth_authenticator:
        class: Kunstmaan\AdminBundle\Security\OAuthAuthenticator
        arguments:
            - '@router'
            - '@session'
            - '@translator'
            - '@kunstmaan_admin.oauth_user_creator'
            - '%kunstmaan_admin.google_signin.client_id%'
            - '%kunstmaan_admin.google_signin.client_secret%'

    kunstmaan_admin.oauth_user_creator:
        class: Kunstmaan\AdminBundle\Helper\Security\OAuth\OAuthUserCreator
        arguments:
            - '@doctrine.orm.entity_manager'
            - '%kunstmaan_admin.google_signin.hosted_domains%'
            - '%fos_user.model.user.class%'
            - '@kunstmaan_admin.oauth_user_finder'

    kunstmaan_admin.oauth_user_finder:
        class: Kunstmaan\AdminBundle\Helper\Security\OAuth\OAuthUserFinder
        arguments:
            - '@doctrine.orm.entity_manager'
            - '%fos_user.model.user.class%'

    kunstmaan_admin.google_signin.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\GoogleSignInTwigExtension
        arguments:
            - '%kunstmaan_admin.google_signin.enabled%'
            - '%kunstmaan_admin.google_signin.client_id%'
        tags:
            - { name: twig.extension }

    kunstmaan_admin.sidebar.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\SidebarTwigExtension
        tags:
            - { name: twig.extension }

    kunstmaan_admin.validator.password_restrictions:
        class: '%kunstmaan_admin.validator.password_restrictions.class%'
        arguments:
            - '%kunstmaan_admin.password_restrictions.min_digits%'
            - '%kunstmaan_admin.password_restrictions.min_uppercase%'
            - '%kunstmaan_admin.password_restrictions.min_special_characters%'
            - '%kunstmaan_admin.password_restrictions.min_length%'
            - '%kunstmaan_admin.password_restrictions.max_length%'
        tags:
            - { name: validator.constraint_validator, alias: password_restrictions }

    kunstmaan_admin.exception.listener:
        class: "%kunstmaan_admin.exception.listener.class%"
        arguments:
            - "@doctrine.orm.entity_manager"
            - "%kunstmaan_admin.admin_exception_excludes%"
        tags:
            - { name: kernel.event_subscriber }

    ### TOOLBAR DATA COLLECTOR ###

    kunstmaan_admin.toolbar.twig.extension:
        class: Kunstmaan\AdminBundle\Twig\ToolbarTwigExtension
        tags:
            - { name: twig.extension }

    kunstmaan_admin.toolbar.datacollector:
        class: Kunstmaan\AdminBundle\Helper\Toolbar\DataCollector
        arguments:
             - '@router'

    Kunstmaan\AdminBundle\Helper\Toolbar\AbstractDataCollector:
        abstract: true
        calls:
            - [setAdminRouteHelper, ['@kunstmaan_admin.adminroute.helper']]

    kunstmaan_admin.toolbar.listener:
        class: '%kunstmaan_admin.toolbar.listener.class%'
        tags:
            - { name: kernel.event_subscriber }
        arguments:
            - '@twig'
            - '@router'
            - '@kunstmaan_admin.toolbar.datacollector'
            - '@security.authorization_checker'
            - '@security.token_storage'
            - '%kunstmaan_admin.enable_toolbar_helper%'
            - '@service_container'
            - '@kunstmaan_admin.adminroute.helper'
            - '%kunstmaan_admin.toolbar_firewall_names%'
            - '%kunstmaan_admin.admin_firewall_name%'

    kunstmaan_admin.datacollector.bundleversion:
        class: '%kunstmaan_admin.toolbar.collector.bundle.class%'
        arguments:
            - '@kunstmaan_admin.versionchecker'
            - '@cache.kunstmaan_versioncheck'
        tags:
            - { name: kunstmaan_admin.toolbar_collector, template: '@KunstmaanAdmin/Toolbar/bundles_version.html.twig', id: kuma_bundle_versions }

    kunstmaan_admin.datacollector.exception:
        class: '%kunstmaan_admin.toolbar.collector.exception.class%'
        arguments: ["@doctrine.orm.entity_manager"]
        tags:
            - { name: kunstmaan_admin.toolbar_collector, template: '@KunstmaanAdmin/Toolbar/exception.html.twig', id: kuma_exception }

    Kunstmaan\AdminBundle\Twig\AdminBundleTwigExtension:
        arguments:
            - '%kunstmaan_admin.website_title%'
            - '%kunstmaan_admin.default_locale%'
            - '%kunstmaan_admin.required_locales%'
        tags:
            - { name: twig.extension }
