security:
  password_hashers:
    App\Security\UserAdapter:
      algorithm: auto

  providers:
    app_user_provider:
      id: App\Security\UserProvider

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

    login:
      pattern: ^/api/auth/login
      stateless: true
      provider: app_user_provider
      json_login:
        check_path: /api/auth/login
        username_path: email
        password_path: password
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure
      # 🔓 création utilisateur publique

    stripe:
      pattern: ^/api/stripe/checkout
      stateless: true
      security: false
    register:
      pattern: ^/api/auth/register
      stateless: true
      security: false
    product:
      pattern: ^/api/products
      stateless: true
      security: false 
    product_categories:
      pattern: ^/api/product_categories
      stateless: true
      security: false
    Product_images:
      pattern: ^/api/product_images
      stateless: true
      security: false
    Product_variants:
      pattern: ^/api/product_variants
      stateless: true
      security: false
    catalog:
      pattern: ^/api/catalogue
      stateless: true
      security: false
    category:
      pattern: ^/api/categories
      stateless: true
      security: false
    refresh-token:
      pattern: ^/api/auth/refresh-token
      stateless: true
      security: false
    api_docs:
      pattern: ^/api/docs
      stateless: true
      security: false  # pas de JWT requis
    api:
      pattern: ^/api
      stateless: true
      provider: app_user_provider
      jwt: ~

  access_control:
    # laisser /api/docs accessible anonymement
    
    - { path: ^^/api/stripe/checkout, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/docs(\.|$), roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/auth/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/products, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/product_categories, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/product_images, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/product_variants, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/catalogue, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/categories, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/auth/refresh-token, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/auth/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
    
    