<?php
$content = (new \App\Settings('content'))->getAll();
$headerLogo = json_decode($content['header-logo'] ?? '{}', true);
$menuItems = json_decode($content['menu'] ?? '[]', true);
?>
<header class="header header-color">
        <div class="container">
            <div class="header__logo">
                <?php if (!empty($headerLogo['src'])): ?>
                    <a href="<?= $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] ?>">
                        <img src="<?= htmlspecialchars($headerLogo['src']) ?>" alt="<?= $headerLogo['alt'] ?? '' ?>" title="<?= $headerLogo['title'] ?? '' ?>">
                    </a>
                <?php endif; ?>
            </div>
            <?php if (!empty($menuItems[0]['title'])): ?>
                <nav class="header__menu">
                    <ul class="header__menu-list">
                        <?php foreach ($menuItems as $menuItem): ?>
                            <li>
                                <a href = "<?= htmlspecialchars($menuItem['anchor'] ?? '') ?>" > <?= htmlspecialchars($menuItem['title'] ?? '') ?></a>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                </nav>
            <?php endif; ?>
            <div class="header__btns">
                <?php if (empty($content['hide-btns'])): ?>
                    <div class="header__pass pulse__btn accent-color pass-btn-color redirect-js"><?= $content['password'] ?></div>
                <?php endif; ?>
                <div class="header__mobile-menu ">
                    <span class="burger"></span>
                </div>
            </div>
        </div>
</header>