<?php

define('DB_HOST', 'localhost');
define('DB_USER', 'creatahc_eb_reading_database');
define('DB_PASS', 'iHlX%sw_;96n{pNO');
define('DB_NAME', 'creatahc_eb_reading_db');
// define('DB_HOST', 'localhost');
// define('DB_USER', 'root');
// define('DB_PASS', '');
// define('DB_NAME', 'meter_reading_db');

define('JWT_SECRET', 'meter_reading_secret_key_2026');
define('JWT_EXPIRY', 86400 * 30); // 30 days

define('BASE_URL', 'https://eb-api.creatah.com');
define('UPLOAD_DIR', __DIR__ . '/../uploads/readings/');
define('UPLOAD_URL', BASE_URL . '/uploads/readings/');
date_default_timezone_set('Asia/Kolkata');
function getDB() {
    $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    if ($conn->connect_error) {
        http_response_code(500);
        echo json_encode(["status" => false, "message" => "Database connection failed"]);
        exit;
    }
    $conn->set_charset("utf8");
    $conn->query("SET time_zone = '+05:30'");
    return $conn;
}
