<script lang="ts">
  import SeoHead from '$lib/components/SeoHead.svelte';
  import Footer from '$lib/components/Footer.svelte';
  import Header from '$lib/components/Header.svelte';
  import HeroSection from '$lib/components/HeroSection.svelte';
  import InfoSection from '$lib/components/InfoSection.svelte';
  import InstagramSection from '$lib/components/InstagramSection.svelte';
  import IntroStrip from '$lib/components/IntroStrip.svelte';
  import BookingSection from '$lib/components/BookingSection.svelte';
  import PromiseSection from '$lib/components/PromiseSection.svelte';
  import ServicesSection from '$lib/components/ServicesSection.svelte';
  import TestimonialsSection from '$lib/components/TestimonialsSection.svelte';
  import ValuesSection from '$lib/components/ValuesSection.svelte';
  import type { PageData } from './$types';

  export let data: PageData;

  const siteUrl = 'https://www.goodwalk.co.nz';

  $: homepageStructuredData = [
    {
      '@context': 'https://schema.org',
      '@type': 'WebSite',
      name: 'Goodwalk',
      url: siteUrl,
      inLanguage: 'en-NZ'
    },
    {
      '@context': 'https://schema.org',
      '@type': 'LocalBusiness',
      name: 'Goodwalk',
      description:
        'Professional dog walking services across Auckland Central, including pack walks, 1:1 walks, and puppy visits.',
      url: siteUrl,
      logo: `${siteUrl}/images/goodwalk-auckland-dog-walking-logo.png`,
      image: data.content.hero.imageUrl,
      email: 'info@goodwalk.co.nz',
      telephone: '+64-22-642-1011',
      sameAs: ['https://www.instagram.com/goodwalk.nz/', 'https://g.page/r/CUsvrWPhkYrAEB0/'],
      address: {
        '@type': 'PostalAddress',
        addressLocality: 'Auckland Central',
        addressRegion: 'Auckland',
        addressCountry: 'NZ'
      },
      areaServed: [
        'Morningside',
        'Kingsland',
        'Ponsonby',
        'Grey Lynn',
        'Mt Albert',
        'Mt Eden',
        'Sandringham',
        'Mt Roskill',
        'Arch Hill',
        'Freemans Bay',
        'Herne Bay',
        'Pt Chevalier',
        'Avondale',
        'Three Kings',
        'Hillsborough',
        'Eden Terrace',
        'Balmoral'
      ],
      openingHoursSpecification: [
        {
          '@type': 'OpeningHoursSpecification',
          dayOfWeek: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
          opens: '08:00',
          closes: '16:00'
        }
      ],
      hasOfferCatalog: {
        '@type': 'OfferCatalog',
        name: 'Dog Walking Services',
        itemListElement: data.content.services.map((service) => ({
          '@type': 'Offer',
          itemOffered: {
            '@type': 'Service',
            name: service.title,
            url: `${siteUrl}${service.href}`
          }
        }))
      }
    },
    {
      '@context': 'https://schema.org',
      '@type': 'FAQPage',
      mainEntity: data.content.info.faqs.map((faq) => ({
        '@type': 'Question',
        name: faq.question,
        acceptedAnswer: {
          '@type': 'Answer',
          text: faq.answer
        }
      }))
    }
  ];
</script>

<SeoHead
  title={data.content.seo.title}
  description={data.content.seo.description}
  canonicalPath="/"
  image={data.content.hero.imageUrl}
  imageAlt={data.content.hero.imageAlt}
  structuredData={homepageStructuredData}
  preloadImage={true}
/>

<Header navigation={data.content.navigation} />
<HeroSection hero={data.content.hero} />
<IntroStrip intro={data.content.intro} />
<PromiseSection promise={data.content.promise} />
<ServicesSection services={data.content.services} />
<ValuesSection values={data.content.values} />
<TestimonialsSection testimonials={data.content.testimonials} />
<BookingSection booking={data.content.booking} />
<InfoSection info={data.content.info} />
<InstagramSection instagram={data.content.instagram} />
<Footer footer={data.content.footer} />
