<?php
declare(strict_types=1);
/**
 * 재고 경보 4단계 + 단계별 봉투 종류(대략)
 *
 * @var list<array{count:int,label:string,class:string,bags:list<string>}> $stockAlerts
 */
?>
<div class="alert-levels">
  <?php foreach ($stockAlerts as $alert): ?>
  <div class="alert-box <?= esc($alert['class'], 'attr') ?>">
    <div class="n"><?= (int) $alert['count'] ?></div>
    <div class="t"><?= esc($alert['label']) ?></div>
    <?php if (! empty($alert['bags'])): ?>
    <ul class="alert-bags" aria-label="<?= esc($alert['label']) ?> 봉투 종류">
      <?php foreach ($alert['bags'] as $bagName): ?>
      <li><?= esc($bagName) ?></li>
      <?php endforeach; ?>
    </ul>
    <?php endif; ?>
  </div>
  <?php endforeach; ?>
</div>
