<?php
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes 2020-present. All rights reserved.
 * This product is licensed per Magento install
 * See https://hyva.io/license
 */

declare(strict_types=1);

use Hyva\Theme\Model\ViewModelRegistry;
use Hyva\Theme\ViewModel\StoreConfig;
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Magento\Theme\Block\Html\Header\Logo;

/** @var Template $block */
/** @var Escaper $escaper */
/** @var ViewModelRegistry $viewModels */

/** @var StoreConfig $storeConfig */
$storeConfig = $viewModels->require(StoreConfig::class);

// Get store information
$storeName = $storeConfig->getStoreConfig('general/store_information/name') ?: 'Banyo';
$storePhone = $storeConfig->getStoreConfig('general/store_information/phone') ?: '+44 116 274 4059';
$storeStreet1 = $storeConfig->getStoreConfig('general/store_information/street_line1') ?: '64 St Barnabas Rd';
$storeCity = $storeConfig->getStoreConfig('general/store_information/city') ?: 'Leicester';
$storeRegion = $storeConfig->getStoreConfig('general/store_information/region_id') ?: 'Leicester Shire';
$storePostcode = $storeConfig->getStoreConfig('general/store_information/postcode') ?: 'LE5 4BD';
$storeCountry = $storeConfig->getStoreConfig('general/store_information/country_id') ?: 'UK';

// Get base URL
$baseUrl = $block->getUrl('');
$storeUrl = rtrim($baseUrl, '/');

// Get logo URL - fallback to hardcoded value if not available
$logoUrl = $storeUrl . '/media/logo/stores/1/BanyoStoreLogo.png';

// Get short description
$storeDescription = $storeConfig->getStoreConfig('general/store_information/description') ?: 'Welcome to Banyo, a trusted and leading online retailer that offers premium bathrooms, kitchen and heating products with expert advice and fast delivery. We offer an extensive catalogue of over 15,000 top-tier products from more than 40 reputable brands. For over 17 years, we’ve proudly served both homeowners and trade professionals with a wide range of stylish bathtubs, spacious shower enclosures, elegant vanity units, modern bathroom furniture, energy-efficient radiators, and a variety of kitchen taps and sinks – all at competitive prices. As a one-stop destination for high-quality home solutions, Banyo has everything you need to bring your vision to life.';
?>
<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@graph": [
        {
          "@type": "OnlineStore",
          "name": "<?= $escaper->escapeHtml($storeName) ?>",
      "legalName": "Banyo UK Ltd.",
      "url": "<?= $escaper->escapeUrl($storeUrl) ?>/",
      "@id": "<?= $escaper->escapeUrl($storeUrl) ?>/#onlineStore",
      "logo": "<?= $escaper->escapeUrl($logoUrl) ?>",
      "description": "<?= $escaper->escapeHtml($storeDescription) ?>",
      "contactPoint": {
        "@type": "ContactPoint",
        "contactType": "customer support",
        "telephone": "<?= $escaper->escapeHtml($storePhone) ?>",
        "availableLanguage": "English",
        "email": "info@banyo.co.uk"
      },
      "sameAs": [
        "https://www.facebook.com/BanyoUK/",
        "https://www.pinterest.co.uk/BanyoUK/",
        "https://x.com/BanyoUK",
        "https://www.youtube.com/@BanyoUK",
        "https://www.trustpilot.com/review/www.banyo.co.uk"
      ]
    }
  ]
}
</script>
