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

$plan = $plan ?? [];
$features = is_array($plan['features'] ?? null) ? $plan['features'] : [];
$currency = 'TRY';
$money = static fn (mixed $value): string => number_format((float) $value, 2, ',', '.') . ' ' . $currency;
?>
<section class="payment-shell">
    <div class="container payment-checkout">
        <div class="payment-hero-panel">
            <p class="eyebrow">Site Premium</p>
            <h1><?= e((string) ($plan['name'] ?? 'Music Premium')) ?></h1>
            <p><?= e((string) (($plan['description'] ?? '') ?: 'Reklamsiz dinleme, premium player ve ileride mobil/desktop app erisimi icin site aboneligi.')) ?></p>

            <div class="payment-creator-strip">
                <span>Paket tipi</span>
                <strong>Creator paketi degil, site aboneligi</strong>
            </div>

            <dl class="payment-breakdown">
                <div><dt>Aylik</dt><dd><?= e($money($plan['price_monthly'] ?? 0)) ?></dd></div>
                <div><dt>6 Ay</dt><dd><?= e($money($plan['price_6_month'] ?? 0)) ?></dd></div>
                <div><dt>12 Ay</dt><dd><?= e($money($plan['price_12_month'] ?? 0)) ?></dd></div>
            </dl>

            <?php if ($features !== []): ?>
                <div class="payment-site-features" aria-label="Premium ozellikleri">
                    <?php foreach ($features as $feature): ?>
                        <span class="pill ghost"><?= e((string) $feature) ?></span>
                    <?php endforeach; ?>
                </div>
            <?php endif; ?>

            <p class="payment-note">Site Premium veri modeli ve abonelik kontrolu hazir. TestPaymentProvider ile tam site plan odeme oturumu sonraki odeme entegrasyon adiminda baglanacak.</p>
        </div>

        <aside class="payment-card checkout-card">
            <div class="payment-card-head">
                <div>
                    <span>Durum</span>
                    <strong>TODO</strong>
                </div>
                <small>Site plan checkout</small>
            </div>
            <p class="payment-note">Bu ekran, muzik premium paketlerinin creator paketlerinden ayrildigini gosterir ve cPanel oncesi local testte veri modelini dogrulamak icin hazirdir.</p>
            <a class="pill primary" href="<?= e(url('/music')) ?>">Muzige Don</a>
            <a class="pill" href="<?= e(url('/studyo/abonelikler')) ?>">Aboneliklerim</a>
        </aside>
    </div>
</section>
