#!/usr/bin/env php
<?php
/**
 * Check Vendor Files
 * Verifies all vendor files are present
 */

$vendors = [
    'bootstrap/css/bootstrap.min.css',
    'bootstrap/js/bootstrap.bundle.min.js',
    'jquery/jquery.min.js',
    'datatables/css/dataTables.bootstrap5.min.css',
    'datatables/js/jquery.dataTables.min.js',
    'datatables/js/dataTables.bootstrap5.min.js',
    'chartjs/chart.min.js',
    'summernote/css/summernote-bs4.min.css',
    'summernote/js/summernote-bs4.min.js',
    'fontawesome/css/all.min.css'
];

$baseDir = __DIR__ . '/../assets/vendor/';
$missing = [];
$present = [];

foreach ($vendors as $vendor) {
    $path = $baseDir . $vendor;
    if (file_exists($path)) {
        $present[] = $vendor;
    } else {
        $missing[] = $vendor;
    }
}

echo "=========================================\n";
echo "Vendor Files Check\n";
echo "=========================================\n\n";
echo "Present: " . count($present) . "/" . count($vendors) . "\n";
echo "Missing: " . count($missing) . "/" . count($vendors) . "\n\n";

if (!empty($missing)) {
    echo "Missing files:\n";
    foreach ($missing as $m) {
        echo "  - $m\n";
    }
    echo "\nRun: bash assets/vendor/download-vendors.sh\n";
    exit(1);
} else {
    echo "✓ All vendor files are present!\n";
    exit(0);
}