<?php
require_once __DIR__ . '/../../models/Database.php';
use Models\Database;

header('Content-Type: application/json');

try {
    $pdo = Database::getInstance()->getConnection();
    $stmt = $pdo->prepare("SELECT value FROM settings WHERE keyname = 'franchise'");
    $stmt->execute();
    $value = (float) $stmt->fetchColumn();

    echo json_encode(['franchise' => $value]);
} catch (Throwable $e) {
    http_response_code(500);
    echo json_encode(['error' => $e->getMessage()]);
}
