<?php
use function App\Core\{e, url};

$item = $item ?? [];
$cover = (string) ($item['cover_image'] ?? $item['cover'] ?? '/uploads/covers/mod-1.svg');
$title = (string) ($item['title'] ?? 'Mod');
$creator = (string) ($item['author_name'] ?? $item['author'] ?? 'Creator');
$views = (int) ($item['view_count'] ?? $item['views'] ?? 0);
$downloads = (int) ($item['download_count'] ?? $item['downloads'] ?? 0);
$isPremium = !empty($item['premium']) || !empty($item['is_premium']);
?>
<a class="related-item" href="<?= url('/mod/' . ($item['slug'] ?? '')) ?>">
    <span class="related-cover">
        <img loading="lazy" src="<?= url($cover) ?>" alt="<?= e($title) ?>">
        <em><?= $isPremium ? 'Premium' : 'Free' ?></em>
    </span>
    <span class="related-copy">
        <strong><?= e($title) ?></strong>
        <small><?= e($creator) ?></small>
        <small><?= number_format($views, 0, ',', '.') ?> goruntulenme - <?= number_format($downloads, 0, ',', '.') ?> indirme</small>
    </span>
</a>
