# config/packages/security.yaml
security:
    encoders:
        App\Entity\User:
            algorithm: bcrypt

    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        refresh:
            pattern: ^/api/token/refresh
            stateless: true
            anonymous: true

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


        api_skills:
            pattern: ^/api/skills
            stateless: true
            provider: app_user_provider
            anonymous: true

        api:
            pattern: ^/api
            stateless: true
            provider: app_user_provider
            guard:
                authenticators:
                    - lexik_jwt_authentication.jwt_token_authenticator


        api_register_recruiter:
            pattern: ^/create/entreprise
            anonymous: true

        api_register_profile:
            pattern: ^/file/manager
            anonymous: true

        main:
            anonymous: true
            provider: app_user_provider

    access_control:
        - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/printCandidateResume, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/token/refresh, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/skills, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/file/manager, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/create/entreprise, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }

