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

try {
    // Create initial bus
    $stmt = $pdo->prepare("INSERT IGNORE INTO buses (bus_number, model, capacity) VALUES ('BA 1 PA 1234', 'Tata Starbus', 35)");
    $stmt->execute();
    $busId = $pdo->lastInsertId() ?: 1;

    // Create initial driver (phone: 9841000000, pass: driver123)
    $passHash = password_hash('driver123', PASSWORD_DEFAULT);
    $stmt = $pdo->prepare("INSERT IGNORE INTO drivers (name, phone, password, bus_id) VALUES ('Ram Bahadur', '9841000000', ?, ?)");
    $stmt->execute([$passHash, $busId]);

    echo "Seed data inserted successfully.\n";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
?>
