<?php
/**
 * config/master-db.php
 * ---------------------------------------------------------------------------
 * Connects to the ONE small tracking database (quickecommerce_master),
 * created by sql/master-schema.sql. Fill in your real credentials below —
 * this is a completely separate database from any individual store's.
 * ---------------------------------------------------------------------------
 */

$QC_MASTER_DB_HOST = '127.0.0.1';
$QC_MASTER_DB_NAME = 'yourcpaneluser_quickecommerce_master'; // cPanel prefixes this automatically
$QC_MASTER_DB_USER = 'yourcpaneluser_qcmaster';
$QC_MASTER_DB_PASS = 'CHANGE_ME';

try {
    $masterDb = new PDO(
        "mysql:host={$QC_MASTER_DB_HOST};dbname={$QC_MASTER_DB_NAME};charset=utf8mb4",
        $QC_MASTER_DB_USER,
        $QC_MASTER_DB_PASS,
        [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
    );
} catch (\PDOException $e) {
    http_response_code(500);
    die(json_encode(['success' => false, 'error' => 'Could not connect to master database.']));
}
