<?php
declare(strict_types=1);

/*
COLORJET Admin Config

IMPORTANT:
1. Change ADMIN_USERNAME.
2. Generate a password hash using:
   https://www.php.net/manual/en/function.password-hash.php
   or run locally:
   php -r "echo password_hash('YourStrongPassword', PASSWORD_DEFAULT);"
3. Replace ADMIN_PASSWORD_HASH below.
*/

const ADMIN_USERNAME = 'colorjet_admin';

/*
Default demo password: ChangeMe@12345
CHANGE THIS BEFORE LIVE USE.
*/
const ADMIN_PASSWORD_HASH = '$2y$10$s0UKHf1FQ1pfoeDP3gTMAOVExKmtOMK0AFH3VUgGQfKuP90cUIv12';

const LEAD_STORE = __DIR__ . '/../private-data/leads.json';

function require_login(): void {
    session_start();
    if (empty($_SESSION['colorjet_admin_logged_in'])) {
        header('Location: login.php');
        exit;
    }
}

function h(string $value): string {
    return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
