<?php
require_once __DIR__ . '/../config/database.php';

try {
    $stmt = $pdo->query("DESCRIBE manual_room_allocations");
    $headerColumns = [];
    while ($row = $stmt->fetch()) {
        if (strpos($row['Field'], 'header') !== false) {
            $headerColumns[] = $row['Field'];
        }
    }
    
    if (empty($headerColumns)) {
        echo "Header columns do not exist. Need to add them.\n";
        // Add the columns
        $sql = "ALTER TABLE manual_room_allocations 
                ADD COLUMN header_font_size INT DEFAULT 24,
                ADD COLUMN header_text_color VARCHAR(7) DEFAULT '#000000',
                ADD COLUMN header_font_weight VARCHAR(10) DEFAULT 'bold'";
        $pdo->exec($sql);
        echo "Header columns added successfully!\n";
    } else {
        echo "Header columns already exist: " . implode(', ', $headerColumns) . "\n";
    }
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>