services:
# -----------------------------------------------------------------------------
#                             Event listeners
# -----------------------------------------------------------------------------
    admin.password_reset_listener:
        class: Bazookas\AdminBundle\EventListener\FOSUserResettingListener
        tags:
            - { name: kernel.event_subscriber }
        arguments:
            - '@router'

# -----------------------------------------------------------------------------
#                             Twig extensions
# -----------------------------------------------------------------------------
    bazookas.admin.twig.admin_menu:
        class: Bazookas\AdminBundle\Twig\MenuExtension
        arguments:
          - "@router"
          - "@security.authorization_checker"
          - "@security.access_map"
          - "@request_stack"
          - "%bazookas_admin.menu%"
        public: false
        tags:
            - { name: twig.extension }

    bazookas.admin.twig.admin_menu_extension:
        class: Bazookas\AdminBundle\Twig\Base\BaseAdminMenuExtension
        arguments:
          - "%kernel.bundles%"
          - "%bazookas_admin.menu%"
        tags:
            - { name: twig.extension }

    bazookas.admin.twig.util_extension:
        class: Bazookas\AdminBundle\Twig\UtilExtension
        public: false
        tags:
            - { name: twig.extension }

    bazookas.admin.twig.access_control_extension:
        class: Bazookas\AdminBundle\Twig\AccessControlExtension
        public: false
        arguments:
          - "@security.authorization_checker"
          - "@security.token_storage"
        tags:
            - { name: twig.extension }

    bazookas.admin.twig.user_extension:
      class: Bazookas\AdminBundle\Twig\UserExtension
      arguments:
        - "@doctrine.orm.entity_manager"
      public: false
      tags:
        - { name: twig.extension }

# -----------------------------------------------------------------------------
#                             Form types
# -----------------------------------------------------------------------------
    bazookas.admin.form.filterForm:
        class: Bazookas\AdminBundle\Form\FilterForm
        arguments:
            - "@translator"
        tags:
            - { name: form.type }

    bazookas.admin.form.entitypicker:
        class: Bazookas\AdminBundle\Form\Type\EntityPickerType
        arguments:
            - "@doctrine.orm.entity_manager"
        tags:
            - { name: form.type, alias: entitypicker }

    bazookas.admin.form.hiddenentity:
        class: Bazookas\AdminBundle\Form\Type\HiddenEntityType
        arguments:
            - "@doctrine.orm.entity_manager"
        tags:
            - { name: form.type, alias: hiddenentity }

    bazookas.admin.form.extension.conditionallyVisible:
        class: Bazookas\AdminBundle\Form\Extension\ConditionallyVisibleExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType, alias: form }

    bazookas.admin.form.type.CMSUserGroupAdminType:
        class: Bazookas\AdminBundle\Form\CMSUserGroupAdminType
        arguments: ["%security.role_hierarchy.roles%"]
        tags:
            - { name: form.type }

    bazookas.admin.form.type.AddCMSUserAdminType:
        class: Bazookas\AdminBundle\Form\AddCMSUserAdminType
        arguments: ["@doctrine.orm.entity_manager", "@security.authorization_checker"]
        tags:
            - { name: form.type }

    bazookas.admin.form.type.EditCMSUserAdminType:
        class: Bazookas\AdminBundle\Form\EditCMSUserAdminType
        arguments: ["@doctrine.orm.entity_manager", "@security.authorization_checker"]
        tags:
            - { name: form.type }

    bazookas.admin.form.type.CMSUserAdminType:
        class: Bazookas\AdminBundle\Form\CMSUserAdminType
        arguments: ["@doctrine.orm.entity_manager", "@security.authorization_checker"]
        tags:
            - { name: form.type }

    bazookas.admin.form.type.RegistrationType:
        class: Bazookas\AdminBundle\Form\RegistrationType
        tags:
            - { name: form.type }

    bazookas.admin.form.ListFilterForm:
        class: Bazookas\AdminBundle\Form\ListFilterForm
        arguments:
          - "@translator"
        tags:
            - { name: form.type }

# -----------------------------------------------------------------------------
#                             Form Extensions
# -----------------------------------------------------------------------------
    bazookas.admin.form.datetime.picker.extension:
        class: Bazookas\AdminBundle\Form\Extension\DateTimeTypeExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\DateTimeType }

    bazookas.admin.form.tooltip.extension:
        class: Bazookas\AdminBundle\Form\Extension\ToolTipExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType }

    bazookas.admin.form.icon.picker.extension:
        class: Bazookas\AdminBundle\Form\Extension\IconPickerExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\TextType }

# -----------------------------------------------------------------------------
#                             Services
# -----------------------------------------------------------------------------
    bazookas.admin.service.exportservice:
        class: Bazookas\AdminBundle\Services\Export\ExportService
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@event_dispatcher"
            - "@translator"

    bazookas.admin.service.TranslationDataService:
        class: Bazookas\AdminBundle\Services\Translation\TranslationDataService
        arguments:
            - "@translator"
            - "%kernel.root_dir%"
            - "%kernel.cache_dir%"
            - "@kernel"

# -----------------------------------------------------------------------------
#                             Controller
# -----------------------------------------------------------------------------
    AdminBundle.controller.ExceptionController:
        class: Bazookas\AdminBundle\Controller\Exception\ExceptionController
        arguments:
          - "@twig"
          - "%kernel.debug%"
          - "%requiredlocales%"

# -----------------------------------------------------------------------------
#                             Page builders
# -----------------------------------------------------------------------------
    bazookas.admin.pagebuilders.CopyPageBuilder:
        class: Bazookas\AdminBundle\PageBuilder\CopyPageBuilder
        arguments:
            - "@translator"
            - "%requiredlocales%"

