{%- comment -%}
  Store (LocalBusiness) JSON-LD + search-console verification.

  ── EDIT PER STORE ──────────────────────────────────────────────
  Everything that differs between stores is in the assigns below.
  Change these and nothing else. Leave a value blank to omit it.

  Ported from the leonabd.com Shrine theme, where this was hardcoded
  into layout/theme.liquid. Kept as a snippet so this theme can be
  reused on another store without carrying the wrong business details.
{%- endcomment -%}

{%- liquid
  assign gsc_verification  = settings.biz_gsc
  assign biz_name          = settings.biz_name | default: shop.name
  assign biz_alt_name      = settings.biz_alt_name
  assign biz_description   = settings.biz_description
  assign biz_telephone     = settings.biz_telephone
  assign biz_email         = settings.biz_email | default: shop.email
  assign biz_street        = settings.biz_street
  assign biz_city          = settings.biz_city
  assign biz_postcode      = settings.biz_postcode
  assign biz_country       = settings.biz_country
  assign biz_area_served   = settings.biz_area_served
  assign biz_price_range   = settings.biz_price_range
  assign biz_payment       = settings.biz_payment
  assign biz_logo          = settings.biz_logo
  assign social_urls       = settings.biz_social
-%}

{%- if gsc_verification != blank -%}
  <meta name="google-site-verification" content="{{ gsc_verification }}">
{%- endif -%}

{%- if biz_name != blank -%}
  <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Store",
      "name": {{ biz_name | json }},
      {%- if biz_alt_name != blank %}"alternateName": {{ biz_alt_name | json }},{% endif %}
      {%- if biz_description != blank %}"description": {{ biz_description | json }},{% endif %}
      {%- if biz_logo != blank %}"image": {{ biz_logo | json }},"logo": {{ biz_logo | json }},{% endif %}
      "url": {{ shop.url | json }},
      {%- if biz_telephone != blank %}"telephone": {{ biz_telephone | json }},{% endif %}
      {%- if biz_email != blank %}"email": {{ biz_email | json }},{% endif %}
      {%- if biz_price_range != blank %}"priceRange": {{ biz_price_range | json }},{% endif %}
      "currenciesAccepted": {{ cart.currency.iso_code | json }},
      {%- if biz_payment != blank %}"paymentAccepted": {{ biz_payment | json }},{% endif %}
      {%- if biz_street != blank -%}
        "address": {
          "@type": "PostalAddress",
          "streetAddress": {{ biz_street | json }},
          "addressLocality": {{ biz_city | json }},
          "postalCode": {{ biz_postcode | json }},
          "addressCountry": {{ biz_country | json }}
        },
      {%- endif -%}
      {%- if biz_area_served != blank -%}
        "areaServed": { "@type": "Country", "name": {{ biz_area_served | json }} },
      {%- endif -%}
      {%- if social_urls != blank -%}
        "sameAs": [
          {%- assign urls = social_urls | split: ',' -%}
          {%- for u in urls -%}{{ u | strip | json }}{%- unless forloop.last -%},{%- endunless -%}{%- endfor -%}
        ],
      {%- endif -%}
      "@id": {{ shop.url | json }}
    }
  </script>
{%- endif -%}
