<?php
declare(strict_types=1);

// Load environment variables
require_once __DIR__ . '/env.php';

// Production configuration using environment variables
return [
    'db' => [
        'host' => EnvironmentLoader::get('DB_HOST', '127.0.0.1'),
        'port' => EnvironmentLoader::getInt('DB_PORT', 3306),
        'database' => EnvironmentLoader::get('DB_NAME', 'herbal_wellness'),
        'username' => EnvironmentLoader::get('DB_USER', 'root'),
        'password' => EnvironmentLoader::get('DB_PASS', ''),
        'charset' => 'utf8mb4',
    ],
    'security' => [
        'jwt_secret' => EnvironmentLoader::get('JWT_SECRET', 'change-this-in-production-9c7c3a3f1f0f4c16a0b9b574f9fef97f'),
        'jwt_issuer' => 'atasteofafricanmarketplace',
        'jwt_exp' => EnvironmentLoader::getInt('SESSION_TIMEOUT', 60 * 60 * 24 * 7),
        'encryption_key' => EnvironmentLoader::get('ENCRYPTION_KEY', 'dev-key-32-chars-long-12345678'),
    ],
    'app' => [
        'base_url' => EnvironmentLoader::get('APP_URL', '/herbal-wellness'),
        'cookie_secure' => EnvironmentLoader::getBoolean('SESSION_SECURE', false),
        'cookie_domain' => EnvironmentLoader::get('COOKIE_DOMAIN', ''),
        'environment' => EnvironmentLoader::get('APP_ENV', 'development'),
        'debug' => EnvironmentLoader::getBoolean('APP_DEBUG', true),
    ],
    'payment' => [
        'stripe_public_key' => EnvironmentLoader::get('STRIPE_PUBLIC_KEY', ''),
        'stripe_secret_key' => EnvironmentLoader::get('STRIPE_SECRET_KEY', ''),
        'stripe_webhook_secret' => EnvironmentLoader::get('STRIPE_WEBHOOK_SECRET', ''),
    ],
    'sms' => [
        'twilio_sid' => EnvironmentLoader::get('TWILIO_SID', ''),
        'twilio_token' => EnvironmentLoader::get('TWILIO_TOKEN', ''),
        'twilio_phone' => EnvironmentLoader::get('TWILIO_PHONE', ''),
    ],
    'email' => [
        'smtp_host' => EnvironmentLoader::get('SMTP_HOST', 'localhost'),
        'smtp_port' => EnvironmentLoader::getInt('SMTP_PORT', 587),
        'smtp_user' => EnvironmentLoader::get('SMTP_USER', ''),
        'smtp_pass' => EnvironmentLoader::get('SMTP_PASS', ''),
        'from_name' => EnvironmentLoader::get('SMTP_FROM_NAME', 'Herbal Wellness Care'),
    ],
    'cache' => [
        'enabled' => EnvironmentLoader::getBoolean('CACHE_ENABLED', false),
        'ttl' => EnvironmentLoader::getInt('CACHE_TTL', 300),
        'redis_host' => EnvironmentLoader::get('REDIS_HOST', 'localhost'),
        'redis_port' => EnvironmentLoader::getInt('REDIS_PORT', 6379),
    ],
    'rate_limiting' => [
        'api_limit' => EnvironmentLoader::getInt('API_RATE_LIMIT', 1000),
        'login_limit' => EnvironmentLoader::getInt('LOGIN_RATE_LIMIT', 5),
        'registration_limit' => EnvironmentLoader::getInt('REGISTRATION_RATE_LIMIT', 3),
    ],
    'upload' => [
        'max_size' => EnvironmentLoader::get('MAX_UPLOAD_SIZE', '10M'),
        'allowed_types' => explode(',', EnvironmentLoader::get('ALLOWED_FILE_TYPES', 'jpg,jpeg,png,pdf')),
        'path' => EnvironmentLoader::get('UPLOAD_PATH', __DIR__ . '/../uploads/'),
    ],
    'logging' => [
        'level' => EnvironmentLoader::get('LOG_LEVEL', 'INFO'),
        'file' => EnvironmentLoader::get('LOG_FILE', __DIR__ . '/../logs/app.log'),
    ],
    'ai' => [
        'provider' => 'openai',
        'api_key' => EnvironmentLoader::get('OPENAI_API_KEY', ''),
        'model' => 'gpt-3.5-turbo',
        'rate_limit_per_hour' => 100,
        'moderation_blocklist' => [
            'bomb', 'suicide', 'rape', 'kill', 'terror', 'child porn'
        ],
    ],
];