<?php

require_once __DIR__ . '/vendor/autoload.php';

define('JWT_SECRET_KEY', "e9a1e971e430e1f2c160cc439acff27d3d8f7ff60e4f6c65e7882717a79172d6c206d381be917e02915e24adc9d4702263d2f9942ff9449cf125bf08317504d6"
);
define('ACCESS_TOKEN_EXPIRATION_SECONDS', (int) 3600);
define('REFRESH_TOKEN_EXPIRATION_SECONDS', (int) 2592000);

$host = 'localhost';
$db = 'platformacrm_TOOL_DB';
$user = 'platformacrm_user1';
$pass = 'STRONGpassword123';
$charset = 'utf8mb4';

$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$options = [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES => false,
];

try {
    $pdo = new PDO($dsn, $user, $pass, $options);
} catch (\PDOException $e) {
    error_log($e->getMessage());
    http_response_code(500);
    echo json_encode(["error" => "Database connection failed"]);
    exit();
}

?>