import {
  businessConfig,
  businessHours,
  getAllServiceAreasFormatted,
  socialProfiles,
} from "@/lib/seo-config"

/**
 * Organization Schema Component
 * Implements organization schema for the homepage.
 */
export function OrganizationSchema() {
  const structuredData = {
    "@context": "https://schema.org",
    "@type": "Organization",
    name: businessConfig.name,
    legalName: businessConfig.legalName,
    url: businessConfig.website,
    logo: {
      "@type": "ImageObject",
      url: `${businessConfig.website}/rmv-logo.png`,
    },
    image: {
      "@type": "ImageObject",
      url: `${businessConfig.website}/images/rocky-mountain-vending-service-area-926x1024.webp`,
    },
    description: businessConfig.description,
    foundingDate: businessConfig.openingDate,
    areaServed: getAllServiceAreasFormatted(),
    openingHoursSpecification: [
      {
        "@type": "OpeningHoursSpecification",
        dayOfWeek: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
        opens: businessHours.monday.open,
        closes: businessHours.monday.close,
      },
    ],
    contactPoint: {
      "@type": "ContactPoint",
      telephone: businessConfig.phoneFormatted,
      contactType: "Customer Service",
      areaServed: "Utah",
      availableLanguage: ["English"],
    },
    sameAs: [
      socialProfiles.linkedin,
      socialProfiles.facebook,
      socialProfiles.youtube,
      socialProfiles.twitter,
    ],
  }

  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
    />
  )
}
