<?php
$envFile = __DIR__ . '/.env';
$env = file_exists($envFile) ? parse_ini_file($envFile) : [];

return [
    'telegram_token' => $env['TELEGRAM_TOKEN'] ?? getenv('TELEGRAM_TOKEN') ?? '',
    'gemini_api_key' => $env['GEMINI_API_KEY'] ?? getenv('GEMINI_API_KEY') ?? '',
    'openai_api_key' => $env['OPENAI_API_KEY'] ?? getenv('OPENAI_API_KEY') ?? '',
    'db_host'        => $env['DB_HOST']        ?? getenv('DB_HOST')        ?? 'localhost',
    'db_name'        => $env['DB_NAME']        ?? getenv('DB_NAME')        ?? '',
    'db_user'        => $env['DB_USER']        ?? getenv('DB_USER')        ?? '',
    'db_pass'        => $env['DB_PASS']        ?? getenv('DB_PASS')        ?? '',
    'gemini_model'   => $env['GEMINI_MODEL']   ?? getenv('GEMINI_MODEL')   ?? 'gemini-2.5-flash',
    'chatgpt_model'  => $env['CHATGPT_MODEL']  ?? getenv('CHATGPT_MODEL')  ?? 'gpt-4o-mini',
    'admin_chat_id'      => $env['ADMIN_CHAT_ID']      ?? getenv('ADMIN_CHAT_ID')      ?? null,
    'setup_key'          => $env['SETUP_KEY']          ?? getenv('SETUP_KEY')          ?? '',
    'support_username'   => $env['SUPPORT_USERNAME']   ?? getenv('SUPPORT_USERNAME')   ?? '',
    'diet_plan_cost'     => (int)($env['DIET_PLAN_COST']     ?? getenv('DIET_PLAN_COST')     ?? 5),
    'workout_plan_cost'  => (int)($env['WORKOUT_PLAN_COST']  ?? getenv('WORKOUT_PLAN_COST')  ?? 5),
    'signup_credits'     => (int)($env['SIGNUP_CREDITS']     ?? getenv('SIGNUP_CREDITS')     ?? 20),
    'admin_password'     => $env['ADMIN_PASSWORD']     ?? getenv('ADMIN_PASSWORD')     ?? '',
    'bot_username'       => $env['BOT_USERNAME']       ?? getenv('BOT_USERNAME')       ?? '',
];
