security:
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'

    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email

    firewalls:
        dev:
            pattern: ^/(_profiler|_wdt|assets|build)/
            security: false
        login:
            pattern: ^/api/auth/(login|verify)
            stateless: true
            security: false
        api:
            pattern: ^/api
            stateless: true
            provider: app_user_provider
            access_token:
                token_handler: App\Security\AccessTokenHandler

    access_control:
        - { path: ^/api/auth/(login|verify), roles: PUBLIC_ACCESS }
        - { path: ^/api/alertes$, roles: PUBLIC_ACCESS, methods: [POST] }
        - { path: ^/api/csv-backup$, roles: PUBLIC_ACCESS, methods: [POST] }
        - { path: ^/api/users/me, roles: ROLE_USER }
        - { path: ^/api/users, roles: [ROLE_ADMIN, ROLE_SUPER_ADMIN] }
        - { path: ^/api/auth, roles: ROLE_USER }
        - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }

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
