security:
    password_hashers:
        App\Entity\Cabinet:
            algorithm: auto
        App\Entity\Admin:
            algorithm: auto

    providers:
        cabinet_provider:
            entity:
                class: App\Entity\Cabinet
                property: login

        admin_provider:
            entity:
                class: App\Entity\Admin
                property: login

    firewalls:
        dev:
            pattern: ^/(_profiler|_wdt|assets|build)/
            security: false

        admin_login:
            pattern: ^/api/admin/login
            stateless: true
            provider: admin_provider
            json_login:
                check_path: /api/admin/login
                username_path: login
                password_path: password
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure

        cabinet_login:
            pattern: ^/api/login
            stateless: true
            provider: cabinet_provider
            json_login:
                check_path: /api/login
                username_path: login
                password_path: password
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure

        admin_api:
            pattern: ^/api/admin
            stateless: true
            provider: admin_provider
            jwt: ~

        cabinet_api:
            pattern: ^/api
            stateless: true
            provider: cabinet_provider
            jwt: ~

    access_control:
         - { path: ^/api/admin/login, roles: PUBLIC_ACCESS }
         - { path: ^/api/login, roles: PUBLIC_ACCESS }

         - { path: ^/api/admin, roles: ROLE_ADMIN }
         - { path: ^/api, roles: ROLE_CABINET }


when@test:
    security:
        password_hashers:
            # Password hashers are resource-intensive by design to ensure security.
            # In tests, it's safe to reduce their cost to improve performance.
            Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
                algorithm: auto
                cost: 4 # Lowest possible value for bcrypt
                time_cost: 3 # Lowest possible value for argon
                memory_cost: 10 # Lowest possible value for argon
            App\Entity\Cabinet:
                algorithm: auto
            App\Entity\Admin:
                algorithm: auto
