<?php
header('Content-Type: application/json');
require_once '../../includes/config.php';

$response = ['status' => false, 'data' => null];

try {
    // Select the record with ID 1
    $stmt = $pdo->prepare("SELECT * FROM school_settings WHERE id = 1 LIMIT 1");
    $stmt->execute();
    $data = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($data) {
        $response['status'] = true;
        $response['data'] = $data;
    } else {
        $response['message'] = "No settings found. Please ensure ID 1 exists.";
    }

} catch (Exception $e) {
    $response['message'] = "Error: " . $e->getMessage();
}

echo json_encode($response);
?>