<?php

return [
    'enabled' => (bool) env('SKINBASE_COUNTRIES_ENABLED', true),
    'remote_source' => env('SKINBASE_COUNTRIES_REMOTE_SOURCE', 'restcountries'),
    'endpoint' => env(
        'SKINBASE_COUNTRIES_ENDPOINT',
        'https://restcountries.com/v3.1/all?fields=cca2,cca3,ccn3,name,region,subregion,flags,flag'
    ),
    'connect_timeout' => (int) env('SKINBASE_COUNTRIES_CONNECT_TIMEOUT', 5),
    'timeout' => (int) env('SKINBASE_COUNTRIES_TIMEOUT', 10),
    'retry_times' => (int) env('SKINBASE_COUNTRIES_RETRY_TIMES', 2),
    'retry_sleep_ms' => (int) env('SKINBASE_COUNTRIES_RETRY_SLEEP_MS', 250),
    'deactivate_missing' => (bool) env('SKINBASE_COUNTRIES_DEACTIVATE_MISSING', false),
    'cache_ttl' => (int) env('SKINBASE_COUNTRIES_CACHE_TTL', 86400),
    'featured_countries' => array_values(array_filter(array_map(
        static fn (string $iso2): string => strtoupper(trim($iso2)),
        explode(',', (string) env('SKINBASE_COUNTRIES_FEATURED', 'SI,HR,AT,DE,IT,US')),
    ))),
    'use_local_flags' => (bool) env('SKINBASE_COUNTRIES_USE_LOCAL_FLAGS', true),
    'fallback_seed_enabled' => (bool) env('SKINBASE_COUNTRIES_FALLBACK_ENABLED', true),
    'fallback_seed_path' => database_path('data/countries-fallback.json'),
];
