<?php
include 'includes/db.php';

echo "<h1>Quick Database Check</h1>";

// Check cities
$cityCount = $pdo->query("SELECT COUNT(*) as count FROM cities")->fetch()['count'];
echo "<p>Cities: $cityCount</p>";

// Check services  
$serviceCount = $pdo->query("SELECT COUNT(*) as count FROM services")->fetch()['count'];
echo "<p>Services: $serviceCount</p>";

// Check combinations
$comboCount = $pdo->query("SELECT COUNT(*) as count FROM city_service")->fetch()['count'];
echo "<p>City-Service combinations: $comboCount</p>";

if ($cityCount == 0 || $serviceCount == 0 || $comboCount == 0) {
    echo "<p style='color: red;'>❌ Missing data! Run the setup script.</p>";
    echo "<p><a href='admin/sync-city-services.php'>Run Sync Script</a></p>";
} else {
    echo "<p style='color: green;'>✅ Data looks good!</p>";
}

// Show sample data
if ($cityCount > 0) {
    $cities = $pdo->query("SELECT * FROM cities LIMIT 3")->fetchAll();
    echo "<h3>Sample Cities:</h3><ul>";
    foreach ($cities as $city) {
        echo "<li>{$city['name']} ({$city['slug']})</li>";
    }
    echo "</ul>";
}

if ($serviceCount > 0) {
    $services = $pdo->query("SELECT * FROM services LIMIT 3")->fetchAll();
    echo "<h3>Sample Services:</h3><ul>";
    foreach ($services as $service) {
        echo "<li>{$service['name']} ({$service['slug']})</li>";
    }
    echo "</ul>";
}
?>