#!/usr/bin/env php
<?php
/**
 * Run All Seeders
 * Executes all seed files in order
 */

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

$pdo = getDB();
$seedsDir = __DIR__;

$seedFiles = [
    'seed_doctors.sql',
    'seed_remedies.sql',
    'seed_chapters.sql',
    'seed_cases.sql'
];

echo "Running database seeds...\n";

foreach ($seedFiles as $seedFile) {
    $seedPath = $seedsDir . '/' . $seedFile;
    
    if (!file_exists($seedPath)) {
        echo "Warning: $seedFile not found\n";
        continue;
    }
    
    echo "Executing: $seedFile... ";
    
    $sql = file_get_contents($seedPath);
    
    try {
        $pdo->exec($sql);
        echo "✓\n";
    } catch (PDOException $e) {
        echo "✗ Error: " . $e->getMessage() . "\n";
    }
}

echo "\nAll seeds completed!\n";