/* global React */
/* Shared site-wide constants and schema helpers */

window.GFH_DATA = {
  legalName: 'Grace Filled Hair LLC',
  name: 'Grace Filled Hair',
  stylist: 'Kallie Gilbert',
  domain: 'https://gracefilled.hair',
  orgId: 'https://gracefilled.hair/#organization',
  phone: '(941) 224-4149',
  phoneE164: '+1-941-555-0142',
  email: 'hello@gracefilled.hair',
  building: 'Phenix Salon Suites — Fruitville Commons',
  street: '6405 Initiative Blvd',
  city: 'Sarasota',
  state: 'FL',
  zip: '34240',
  areaServed: ['Sarasota, FL', 'Lakewood Ranch, FL'],
  instagram: '@gracefilledhair',
  instagramUrl: 'https://instagram.com/gracefilledhair',
  hours: [
    { days: 'Tuesday to Friday', range: '9 to 5' },
    { days: 'Saturday', range: '9 to 1' },
    { days: 'Sunday and Monday', range: 'closed' },
  ],
};

/* Build the canonical LocalBusiness/HairSalon node, referenced by @id elsewhere */
window.GFH_LocalBusinessSchema = function () {
  return {
    "@context": "https://schema.org",
    "@type": ["LocalBusiness", "HairSalon"],
    "@id": "https://gracefilled.hair/#organization",
    "name": "Grace Filled Hair",
    "legalName": "Grace Filled Hair LLC",
    "description": "Faith-forward hair salon in a private salon suite. Serving Sarasota and Lakewood Ranch, FL.",
    "url": "https://gracefilled.hair",
    "image": "https://gracefilled.hair/assets/logo-full.png",
    "logo": "https://gracefilled.hair/assets/logo-full.png",
    "telephone": "+1-941-555-0142",
    "email": "hello@gracefilled.hair",
    "priceRange": "$$",
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "6405 Initiative Blvd",
      "addressLocality": "Sarasota",
      "addressRegion": "FL",
      "postalCode": "34240",
      "addressCountry": "US"
    },
    "areaServed": [
      { "@type": "City", "name": "Sarasota" },
      { "@type": "City", "name": "Lakewood Ranch" }
    ],
    "openingHoursSpecification": [
      { "@type": "OpeningHoursSpecification", "dayOfWeek": ["Tuesday","Wednesday","Thursday","Friday"], "opens": "09:00", "closes": "17:00" },
      { "@type": "OpeningHoursSpecification", "dayOfWeek": ["Saturday"], "opens": "09:00", "closes": "13:00" }
    ],
    "founder": {
      "@type": "Person",
      "name": "Kallie Gilbert",
      "jobTitle": "Christian Hair Stylist"
    },
    "sameAs": [
      "https://instagram.com/gracefilledhair"
    ]
  };
};

/* Inject one or more JSON-LD blobs into <head> */
window.GFH_injectSchema = function (objects) {
  const arr = Array.isArray(objects) ? objects : [objects];
  arr.forEach(obj => {
    const s = document.createElement('script');
    s.type = 'application/ld+json';
    s.textContent = JSON.stringify(obj);
    document.head.appendChild(s);
  });
};
