<?php

$defaultTtl = (int) env('API_RESPONSE_CACHE_TTL', 300);
$reportingTtl = (int) env('API_RESPONSE_CACHE_REPORTING_TTL', 180);
$notificationsTtl = (int) env('API_RESPONSE_CACHE_NOTIFICATIONS_TTL', 120);

return [
    'enabled' => env('API_RESPONSE_CACHE_ENABLED', true),
    'store' => env('API_RESPONSE_CACHE_STORE', 'redis'),
    'prefix' => env('API_RESPONSE_CACHE_PREFIX', 'api-response'),
    'default_ttl' => $defaultTtl,

    'routes' => [
        'users.index' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_USERS_TTL', $defaultTtl),
            'groups' => ['users', 'reporting_profiles'],
            'shared' => true,
        ],
        'users.profiling-metrics' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_PROFILING_TTL', $reportingTtl),
            'groups' => ['users', 'rosters', 'reporting_profiles'],
            'shared' => true,
        ],
        'user-mistakes.index' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_MISTAKES_TTL', $defaultTtl),
            'groups' => ['user_mistakes'],
            'shared' => true,
        ],
        'rosters.index' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_ROSTERS_TTL', $defaultTtl),
            'groups' => ['rosters', 'users'],
            'shared' => true,
        ],
        'roster-history.index' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_ROSTER_HISTORY_TTL', $defaultTtl),
            'groups' => ['rosters', 'users'],
            'shared' => true,
        ],
        'roster-results.index' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_ROSTER_RESULTS_TTL', $defaultTtl),
            'groups' => ['rosters', 'roster_results'],
            'shared' => true,
        ],
        'roster-results.uploads' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_ROSTER_UPLOADS_TTL', $defaultTtl),
            'groups' => ['roster_results'],
            'shared' => true,
        ],
        'notifications.index' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_NOTIFICATIONS_TTL', $notificationsTtl),
            'groups' => ['users'],
            'shared' => true,
        ],
        'reporting.design' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_REPORTING_TTL', $reportingTtl),
            'groups' => ['reporting_snapshots'],
            'shared' => true,
        ],
        'reporting.qa' => [
            'ttl' => (int) env('API_RESPONSE_CACHE_REPORTING_TTL', $reportingTtl),
            'groups' => ['reporting_snapshots'],
            'shared' => true,
        ],
    ],
];
