const SITE_URL = "https://www.rajvisocialwelfare.org";

export function organizationSchema() {
  return {
    "@context": "https://schema.org",
    "@type": "NGO",
    name: "Rajvi Social Welfare Trust",
    url: SITE_URL,
    logo: `${SITE_URL}/logo.webp`,
    image: `${SITE_URL}/images/1.webp`,
    description:
      "Rajvi Social Welfare Trust works for education support, healthcare awareness, women empowerment, youth development, environmental awareness and community welfare initiatives across India.",
    areaServed: "India",
    address: {
      "@type": "PostalAddress",
      streetAddress: "238, Plot No. 8, Near IDFC Bank, Pocket C, Sector 13",
      addressLocality: "Dwarka",
      addressRegion: "New Delhi",
      postalCode: "110077",
      addressCountry: "IN",
    },
    contactPoint: {
      "@type": "ContactPoint",
      telephone: "+91-7310295095",
      contactType: "customer support",
      areaServed: "IN",
      availableLanguage: ["Hindi", "English"],
    },
    sameAs: ["https://www.facebook.com/rajvisocialwelfare"],
  };
}

export function breadcrumbSchema(items: { name: string; url: string }[]) {
  return {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    itemListElement: items.map((item, index) => ({
      "@type": "ListItem",
      position: index + 1,
      name: item.name,
      item: `${SITE_URL}${item.url}`,
    })),
  };
}

export function faqSchema(faqs: { question: string; answer: string }[]) {
  return {
    "@context": "https://schema.org",
    "@type": "FAQPage",
    mainEntity: faqs.map((faq) => ({
      "@type": "Question",
      name: faq.question,
      acceptedAnswer: {
        "@type": "Answer",
        text: faq.answer,
      },
    })),
  };
}

export function articleSchema({
  title,
  description,
  image,
  url,
  datePublished = "2026-06-14",
  dateModified = "2026-06-14",
}: {
  title: string;
  description: string;
  image: string;
  url: string;
  datePublished?: string;
  dateModified?: string;
}) {
  return {
    "@context": "https://schema.org",
    "@type": "Article",
    headline: title,
    description,
    image: image.startsWith("http") ? image : `${SITE_URL}${image}`,
    author: {
      "@type": "Organization",
      name: "Rajvi Social Welfare Trust",
      url: SITE_URL,
    },
    publisher: {
      "@type": "Organization",
      name: "Rajvi Social Welfare Trust",
      logo: {
        "@type": "ImageObject",
        url: `${SITE_URL}/logo.webp`,
      },
    },
    mainEntityOfPage: `${SITE_URL}${url}`,
    datePublished,
    dateModified,
  };
}

export function eventSchema({
  title,
  description,
  image,
  url,
  location = "India",
  startDate = "2026-07-01",
}: {
  title: string;
  description: string;
  image: string;
  url: string;
  location?: string;
  startDate?: string;
}) {
  return {
    "@context": "https://schema.org",
    "@type": "Event",
    name: title,
    description,
    image: image.startsWith("http") ? image : `${SITE_URL}${image}`,
    startDate,
    eventAttendanceMode: "https://schema.org/OfflineEventAttendanceMode",
    eventStatus: "https://schema.org/EventScheduled",
    location: {
      "@type": "Place",
      name: location,
      address: location,
    },
    organizer: {
      "@type": "NGO",
      name: "Rajvi Social Welfare Trust",
      url: SITE_URL,
    },
    url: `${SITE_URL}${url}`,
  };
}

export function websiteSchema() {
  return {
    "@context": "https://schema.org",
    "@type": "WebSite",
    name: "Rajvi Social Welfare Trust",
    url: SITE_URL,
    potentialAction: {
      "@type": "SearchAction",
      target: `${SITE_URL}/blogs?search={search_term_string}`,
      "query-input": "required name=search_term_string",
    },
  };
}