<?php
$db = Database::getInstance();
$openIssues = (int)$db->fetchColumn("SELECT COUNT(*) FROM data_quality_issues WHERE status = 'open'");
$criticalIssues = (int)$db->fetchColumn("SELECT COUNT(*) FROM data_quality_issues WHERE status = 'open' AND severity IN ('error','critical')");
$warningIssues = $openIssues - $criticalIssues;
?>
<div class="card h-100">
    <div class="card-header"><h6 class="mb-0"><i class="fas fa-check-double me-2 text-warning"></i>Data Quality</h6></div>
    <div class="card-body">
        <div class="row text-center">
            <div class="col-4"><h4 class="mb-0 text-warning"><?= $openIssues ?></h4><small class="text-muted">Open Issues</small></div>
            <div class="col-4"><h4 class="mb-0 text-danger"><?= $criticalIssues ?></h4><small class="text-muted">Critical</small></div>
            <div class="col-4"><h4 class="mb-0 text-info"><?= $warningIssues ?></h4><small class="text-muted">Warnings</small></div>
        </div>
        <div class="mt-3 text-center"><a href="/admin/data-quality" class="btn btn-sm btn-outline-primary">View Details</a></div>
    </div>
</div>