<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "<h1>Test Page</h1>";
echo "<p>PHP is working!</p>";

// Test database connection
try {
    require_once '../config/database.php';
    $database = new Database();
    $db = $database->getConnection();
    echo "<p style='color: green;'>✓ Database connection successful!</p>";
} catch (Exception $e) {
    echo "<p style='color: red;'>✗ Database error: " . $e->getMessage() . "</p>";
}

// Test models
$models = [
    'User' => '../models/user.php',
    'Product' => '../models/product.php',
    'Order' => '../models/order.php',
    'Review' => '../models/review.php',
    'BeautyService' => '../models/beautyservice.php',
    'BeautyBooking' => '../models/beautybooking.php',
    'Post' => '../models/post.php',
    'Category' => '../models/category.php',
];

echo "<h2>Testing Models:</h2>";
foreach ($models as $name => $path) {
    if (file_exists($path)) {
        try {
            require_once $path;
            echo "<p style='color: green;'>✓ $name loaded</p>";
        } catch (Exception $e) {
            echo "<p style='color: red;'>✗ $name error: " . $e->getMessage() . "</p>";
        }
    } else {
        echo "<p style='color: red;'>✗ $name file not found: $path</p>";
    }
}

// Test controller
echo "<h2>Testing Controller:</h2>";
$controller_path = '../controllers/admin_controller.php';
if (file_exists($controller_path)) {
    try {
        require_once $controller_path;
        echo "<p style='color: green;'>✓ AdminController loaded</p>";
    } catch (Exception $e) {
        echo "<p style='color: red;'>✗ AdminController error: " . $e->getMessage() . "</p>";
    }
} else {
    echo "<p style='color: red;'>✗ AdminController file not found</p>";
}

echo "<hr>";
echo "<p><a href='index.php'>Go to Admin Index</a></p>";
