<?php
/**
 * Services Configuration
 * API keys are loaded from config/.env when available.
 * See config/.env.example for setup instructions.
 */

// ── Load .env if it exists ────────────────────────────────────
$envFile = __DIR__ . '/.env';
$env = [];
if (file_exists($envFile)) {
    foreach (file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
        if (str_starts_with(trim($line), '#') || !str_contains($line, '=')) continue;
        [$key, $val] = explode('=', $line, 2);
        $env[trim($key)] = trim($val);
    }
}

return [
    'ocr_space' => [
        // ⚠ Replace the fallback key with a real key via config/.env (OCR_SPACE_API_KEY)
        // Get your free/premium key at: https://ocr.space/ocrapi
        'api_key'  => $env['OCR_SPACE_API_KEY']  ?? 'K81413151988957',
        'endpoint' => $env['OCR_SPACE_ENDPOINT']  ?? 'https://api.ocr.space/parse/image',
    ],
];
