services:
    nordmind_system_foundation.security.user_provider:
        class: Nordmind\SystemFoundationBundle\Provider\UserProvider
        arguments:
           - '@nordmind_system_foundation.user_accounts'

    nordmind_system_foundation.post_voter:
        class:  Nordmind\SystemFoundationBundle\Voter\Voter
        tags:
            - { name: security.voter }
        public: false

    nordmind_system_foundation.user_account.roles:
        class: '%nordmind_system_foundation.roles_repository_class%'
        arguments:
            - '@doctrine.orm.entity_manager'

    nordmind_system_foundation.handler.update_user_roles_handler:
        class: Nordmind\SystemFoundation\Application\UserAccount\Command\UpdateUserRolesHandler
        arguments:
            - '@nordmind_system_foundation.user_account.roles'
        tags:
            - { name: tactician.handler, command: Nordmind\SystemFoundation\Application\UserAccount\Command\UpdateUserRoles }

    nordmind.system_foundation.security.query.current_user_query:
        class: Nordmind\SystemFoundation\Application\Security\Query\CurrentUserQuery

    nordmind.system_foundation.security.command.login_handler:
        class: Nordmind\SystemFoundation\Application\Security\Command\LoginHandler
        arguments:
            - '@nordmind_system_foundation.security.user_provider'
            - '@security.password_encoder'
        tags:
            - { name: tactician.handler, command: Nordmind\SystemFoundation\Application\Security\Command\Login }

    nordmind_system_foundation.core.jwt.token_refresh_listener:
        class: Nordmind\SystemFoundationBundle\Listener\TokenRefreshListener
        arguments: ['@service_container']
        tags:
            - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
