<?php
/**
 * fahrschuldesk API Configuration
 */

declare(strict_types=1);

return [
    'app' => [
        'name' => 'fahrschuldesk API',
        'env' => getenv('APP_ENV') ?: 'production',
        'debug' => getenv('APP_DEBUG') === 'true',
        'timezone' => 'Europe/Berlin',
    ],
    
    'db' => [
        'host' => getenv('DB_HOST') ?: '10.255.30.11',
        'port' => (int)(getenv('DB_PORT') ?: 5433),
        'database' => getenv('DB_DATABASE') ?: 'fahrschuldesk',
        'username' => getenv('DB_USERNAME') ?: 'fahrschuldesk_api',
        'password' => getenv('DB_PASSWORD') ?: '',
    ],
    
    'jwt' => [
        'secret' => getenv('JWT_SECRET') ?: 'change-this-in-production',
        'expiry' => 3600 * 24, // 24 hours
        'refresh_expiry' => 3600 * 24 * 30, // 30 days
    ],
    
    'storage' => [
        'path' => getenv('STORAGE_PATH') ?: '/srv/web/fahrschuldesk/storage',
    ],
    
    'mail' => [
        'driver' => getenv('MAIL_DRIVER') ?: 'log', // log, smtp
        'from' => [
            'address' => 'noreply@fahrschuldesk.de',
            'name' => 'fahrschuldesk',
        ],
    ],
    
    'cors' => [
        'allowed_origins' => explode(',', getenv('CORS_ORIGINS') ?: 'https://fahrschuldesk.de,https://www.fahrschuldesk.de'),
        'allowed_methods' => ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
        'allowed_headers' => ['Content-Type', 'Authorization', 'X-Requested-With'],
        'allow_credentials' => true,
    ],
];