<?php
/**
 * Configuration File
 * Contains Database settings, Table Prefix, and API credentials.
 */

// Database Credentials
define('DB_HOST', 'localhost');
define('DB_USER', 'nextgens_clients_websites');
define('DB_PASS', 'RAHMATdewan..11');
define('DB_NAME', 'nextgens_clients_website');

// Database Table Prefix to avoid conflicts
define('DB_PREFIX', 'ste_');

// Gemini AI Chatbot Configuration
// Replace 'YOUR_GEMINI_API_KEY' with your actual Gemini API Key
define('GEMINI_API_KEY', 'AQ.Ab8RN6I-pEE1HSiv7Tzc9esHKYJGEYIX73EVhU0l5gPTQDdJHQ');
define('GEMINI_MODEL', 'gemini-2.5-flash'); // Using Gemini 2.5 Flash as requested

// Global Database Connection Variable
$conn = null;

try {
    // Disable error reporting for mysqli to handle it gracefully in try-catch
    mysqli_report(MYSQLI_REPORT_OFF);
    
    $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    
    // Check connection
    if ($conn->connect_error) {
        $conn = null; // Connection failed, fallback will be used
    } else {
        $conn->set_charset("utf8mb4");
    }
} catch (Exception $e) {
    $conn = null; // On exception, ensure $conn is null for fallback system
}