<?php use function App\Core\e; $section = 'muzik-telif'; ?>
<div class="panel zpanel zpanel-app">
    <?php require BASE_PATH . '/app/Views/zpanel/_sidebar.php'; ?>
    <section class="panel-body zpanel-main" data-zpanel-page>
        <div class="zpanel-head"><div><p class="eyebrow">ZPanel</p><h1>Muzik Telif Inceleme</h1><p class="muted">Local hash/keyword bot sonuclari ve manuel review.</p></div></div>
        <form class="zpanel-filters" method="get">
            <select name="status"><option value="">Tum durumlar</option><?php foreach (['pending','review','duplicate','blocked','clean'] as $status): ?><option value="<?= e($status) ?>" <?= ($_GET['status'] ?? '') === $status ? 'selected' : '' ?>><?= e($status) ?></option><?php endforeach; ?></select>
            <button class="pill primary">Filtrele</button>
        </form>
        <section class="zpanel-card"><div class="table-scroll"><table class="zpanel-table">
            <thead><tr><th>Track</th><th>User</th><th>Status</th><th>Risk</th><th>Sebepler</th><th>Provider</th><th>Aksiyon</th></tr></thead><tbody>
            <?php foreach (($checks ?? []) as $check): ?>
                <?php $reasons = json_decode((string) ($check['reasons'] ?? '[]'), true); ?>
                <tr>
                    <td><strong><?= e($check['title'] ?? '-') ?></strong><span class="muted block"><?= e($check['artist_name'] ?? '') ?> / <?= e($check['slug'] ?? '') ?></span></td>
                    <td><?= e($check['username'] ?? '-') ?></td>
                    <td><span class="status-pill status-<?= e($check['status'] ?? '') ?>"><?= e($check['status'] ?? '-') ?></span><span class="muted block">track: <?= e($check['track_status'] ?? '-') ?></span></td>
                    <td><span class="risk-score"><?= e((string) ($check['risk_score'] ?? 0)) ?></span></td>
                    <td><?= e(is_array($reasons) ? implode(', ', $reasons) : (string) ($check['reasons'] ?? '')) ?></td>
                    <td><?= e($check['provider'] ?? '-') ?></td>
                    <td class="action-row">
                        <form data-zpanel-form action="/api/zpanel/copyright/approve" method="post" data-confirm="Temiz olarak onaylansin mi?"><input type="hidden" name="_csrf" value="<?= e($csrfToken ?? '') ?>"><input type="hidden" name="id" value="<?= e($check['id'] ?? '') ?>"><button type="submit">Onayla</button></form>
                        <form data-zpanel-form action="/api/zpanel/copyright/reject" method="post" data-confirm="Telif nedeniyle reddedilsin mi?"><input type="hidden" name="_csrf" value="<?= e($csrfToken ?? '') ?>"><input type="hidden" name="id" value="<?= e($check['id'] ?? '') ?>"><button type="submit">Reddet</button></form>
                        <form data-zpanel-form action="/api/zpanel/copyright/block" method="post" data-confirm="Track blocklansin mi?"><input type="hidden" name="_csrf" value="<?= e($csrfToken ?? '') ?>"><input type="hidden" name="id" value="<?= e($check['id'] ?? '') ?>"><button type="submit">Blockla</button></form>
                    </td>
                </tr>
            <?php endforeach; ?>
            <?php if (empty($checks)): ?><tr><td colspan="7">Telif kontrol kaydi yok.</td></tr><?php endif; ?>
            </tbody></table></div></section>
    </section>
</div>
