framework:
    cache:
        # Unique name of your app: used to compute stable namespaces for cache keys.
        prefix_seed: classeo/backend

        pools:
            # Pool dédié aux tokens d'activation (7 jours TTL)
            activation_tokens.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 604800 # 7 jours

            # Pool dédié aux utilisateurs (pas de TTL - données persistantes)
            users.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 0 # Pas d'expiration

            # Pool dédié aux refresh tokens (7 jours TTL max)
            refresh_tokens.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 604800 # 7 jours

            # Pool dédié aux tokens de reset mot de passe (1 heure TTL)
            password_reset_tokens.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 3600 # 1 heure

            # Pool dédié au rate limiting (15 min TTL)
            cache.rate_limiter:
                adapter: cache.adapter.filesystem
                default_lifetime: 900 # 15 minutes

            # Pool dédié aux liaisons parents-enfants (pas de TTL - données persistantes)
            student_guardians.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 0 # Pas d'expiration

            # Pool dédié aux sessions (7 jours TTL max)
            sessions.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 604800 # 7 jours

            # Pool dédié au cache des requêtes paginées (1h TTL, tag-aware)
            paginated_queries.cache:
                adapter: cache.adapter.filesystem
                default_lifetime: 3600 # 1 heure
                tags: true

# Test environment uses Redis to avoid filesystem cache timing issues in E2E tests
# (CLI creates tokens, FrankenPHP must see them immediately)
when@test:
    framework:
        cache:
            pools:
                activation_tokens.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 604800
                users.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 0
                refresh_tokens.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 604800
                password_reset_tokens.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 3600
                cache.rate_limiter:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 900
                student_guardians.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 0
                sessions.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 604800
                paginated_queries.cache:
                    adapter: cache.adapter.redis_tag_aware
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 3600

when@prod:
    framework:
        cache:
            pools:
                doctrine.system_cache_pool:
                    adapter: cache.adapter.system
                doctrine.result_cache_pool:
                    adapter: cache.adapter.system
                activation_tokens.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 604800 # 7 jours
                users.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 0 # Pas d'expiration
                refresh_tokens.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 604800 # 7 jours
                password_reset_tokens.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 3600 # 1 heure
                cache.rate_limiter:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 900 # 15 minutes
                student_guardians.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 0 # Pas d'expiration
                sessions.cache:
                    adapter: cache.adapter.redis
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 604800 # 7 jours
                paginated_queries.cache:
                    adapter: cache.adapter.redis_tag_aware
                    provider: '%env(REDIS_URL)%'
                    default_lifetime: 3600 # 1 heure
