import { SITE, type Lang } from "@/lib/config";
import JsonLd from "@/components/JsonLd";
import type { Metadata } from "next";

export const metadata: Metadata = {
  title: "Clinic Automation Glossary | Mawidi",
  description:
    "Definitions of key terms in clinic automation: No-Show Rate, Deposit Collection, WhatsApp Business API, and more.",
};

const terms = [
  {
    termEn: "No-Show Rate",
    termAr: "معدل عدم الحضور",
    defEn:
      "The percentage of patients who book an appointment but fail to attend without cancelling. In GCC clinics, this averages 30-40% without automation.",
    defAr:
      "نسبة المرضى الذين يحجزون موعداً ولكن لا يحضرون دون إلغاء مسبق. يبلغ المتوسط في عيادات الخليج 30-40% بدون أتمتة.",
  },
  {
    termEn: "WhatsApp Business API",
    termAr: "واجهة برمجة واتساب للأعمال",
    defEn:
      "The enterprise-grade version of WhatsApp that allows automation, verified green ticks, and integration with clinic software (unlike the regular app).",
    defAr:
      "النسخة المؤسسية من واتساب التي تسمح بالأتمتة، والعلامة الخضراء الموثقة، والربط مع أنظمة العيادات (بخلاف التطبيق العادي).",
  },
  {
    termEn: "Prepaid Deposit",
    termAr: "العربون المسبق",
    defEn:
      "A partial payment collected automatically via link before the appointment is confirmed to guarantee attendance.",
    defAr:
      "دفعة جزئية يتم تحصيلها آلياً عبر رابط قبل تأكيد الموعد لضمان التزام المريض بالحضور.",
  },
  {
    termEn: "Recall Campaign",
    termAr: "حملة إعادة التنشيط",
    defEn:
      "Automated messages sent to dormant patients (e.g., visited 6 months ago) to encourage them to book a new service.",
    defAr:
      "رسائل آلية تُرسل للمرضى المنقطعين (مثلاً: زاروا العيادة قبل 6 أشهر) لتشجيعهم على حجز خدمة جديدة.",
  },
  {
    termEn: "RAG (Retrieval-Augmented Generation)",
    termAr: "التوليد المعزز بالاسترجاع",
    defEn:
      "The AI technology Mawidi uses to read your specific clinic PDF guidelines before answering patient questions, ensuring accuracy.",
    defAr:
      "تقنية الذكاء الاصطناعي التي يستخدمها موعدي لقراءة ملفات PDF الخاصة بعيادتك قبل الإجابة على أسئلة المرضى لضمان الدقة.",
  },
];

export default function GlossaryPage({ params }: { params: { lang: Lang } }) {
  const { lang } = params;
  const isAr = lang === "ar";

  return (
    <main className="bg-white py-20 dark:bg-slate-950">
      <div className="mx-auto max-w-4xl px-6">
        <header className="mb-16 text-center">
          <h1 className="text-3xl font-bold text-slate-900 dark:text-white md:text-5xl">
            {isAr
              ? "قاموس مصطلحات الأتمتة الطبية"
              : "Clinic Automation Glossary"}
          </h1>
          <p className="mt-4 text-xl text-slate-600 dark:text-slate-300">
            {isAr
              ? "شرح للمفاهيم التقنية التي تساعد عيادتك على النمو"
              : "Explaining the tech concepts that help your clinic grow"}
          </p>
        </header>

        <div className="grid gap-8">
          {terms.map((item) => (
            <div
              key={item.termEn}
              className="group rounded-2xl border border-slate-100 bg-white p-8 shadow-sm transition-shadow hover:shadow-md dark:border-slate-800 dark:bg-slate-900"
            >
              <h2 className="text-2xl font-bold text-brand-green">
                {isAr ? item.termAr : item.termEn}
              </h2>
              <p className="mt-3 text-lg leading-relaxed text-slate-600 dark:text-slate-300">
                {isAr ? item.defAr : item.defEn}
              </p>
            </div>
          ))}
        </div>
      </div>

      <JsonLd
        type="FAQPage"
        data={{
          mainEntity: terms.map((t) => ({
            "@type": "Question",
            name: isAr ? `ما هو ${t.termAr}؟` : `What is ${t.termEn}?`,
            acceptedAnswer: {
              "@type": "Answer",
              text: isAr ? t.defAr : t.defEn,
            },
          })),
        }}
      />
    </main>
  );
}
