'use client';

import React from 'react';
import { useSearchParams } from 'next/navigation';
import Navbar from '../../components/Common/Navbar';
import Footer from '../../components/Common/Footer';

export default function SLA() {
  const searchParams = useSearchParams();

  const firstName = searchParams.get('firstName') || '';
  const lastName = searchParams.get('lastName') || '';
  const pharmacyName = searchParams.get('pharmacyName') || searchParams.get('labName') || '';

  const country = searchParams.get('country') || '';
  const currentDate = new Date().toLocaleDateString();

  return (
    <>
      <Navbar />
      <main className="bg-white min-h-screen text-gray-800 mt-6">
        <div className="max-w-5xl mx-auto px-6 py-12 mt-6">
          <header className="text-center mb-12 mt-6">
            <h1 className="text-4xl md:text-5xl font-bold text-primary mt-12">
              Service Level Agreement (SLA) – Labs & Pharmacies
            </h1>
          </header>

          <div className="prose max-w-none prose-headings:text-primary prose-li:marker:text-primary">
            <section className="border-b border-gray-200 pb-6 mb-8 text-center">
              <p>
                Between<br />
                <strong>Med Bridge Afrik</strong><br />
                and<br />
                <strong>{pharmacyName || '[Third Party Name – Laboratory or Pharmacy]'}</strong>
              </p>
              <p className="mt-2">
                <strong>Effective Date:</strong> {currentDate}<br />
                <strong>Duration:</strong> Renewable annually
              </p>
            </section>

            {/* 1. Purpose */}
            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>1. Purpose</b></h2>
              <p>
                This Service Level Agreement outlines the terms and conditions under which{' '}
                {pharmacyName || '[Third Party Name]'} will provide services to support the operations of Med Bridge Afrik in delivering digital health services.
              </p>
            </section>

            {/* 2. Scope of Services */}
            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>2. Scope of Services</b></h2>

              <h3><b>2.1 Laboratory Services</b></h3>
              <ul>
                <li>Accept and process test orders from the digital platform.</li>
                <li>Collect and/or process patient samples per medical standards.</li>
                <li>Deliver test results electronically within agreed timelines (e.g., 24–48 hrs).</li>
              </ul>

              <h3><b>2.2 Pharmacy Services</b></h3>
              <ul>
                <li>Fulfill prescriptions received through the platform.</li>
                <li>Provide medication counseling where applicable.</li>
                <li>Ensure delivery/pickup within expected timeframes (e.g., 4 hours in urban areas).</li>
              </ul>
            </section>

            {/* 3. Performance Standards */}
            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>3. Service Performance Standards</b></h2>
              <table className="w-full text-sm border border-gray-300">
                <thead className="bg-gray-100">
                  <tr>
                    <th className="border p-2 text-left">Service Type</th>
                    <th className="border p-2 text-left">SLA Metric</th>
                    <th className="border p-2 text-left">Target Performance</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td className="border p-2">Lab Test Turnaround</td>
                    <td className="border p-2">Time from sample receipt to result delivery</td>
                    <td className="border p-2">95% within 48 hours</td>
                  </tr>
                  <tr>
                    <td className="border p-2">Prescription Fulfillment</td>
                    <td className="border p-2">Time from receipt to delivery/pickup readiness</td>
                    <td className="border p-2">90% within 4 hours</td>
                  </tr>
                  <tr>
                    <td className="border p-2">Data Accuracy</td>
                    <td className="border p-2">Error rate in test results/prescriptions</td>
                    <td className="border p-2">&lt;1% per month</td>
                  </tr>
                  <tr>
                    <td className="border p-2">Availability</td>
                    <td className="border p-2">System uptime & communication availability</td>
                    <td className="border p-2">99.5% monthly</td>
                  </tr>
                </tbody>
              </table>
            </section>

            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>4. Roles and Responsibilities</b></h2>

              <p><b>Virtual Health Provider:</b></p>
              <ul>
                <li>Provide clear and complete electronic orders.</li>
                <li>Notify third parties of urgent or special cases.</li>
                <li>Ensure platform availability for communication/data exchange.</li>
              </ul>

              <p className="mt-4"><b>Third Party:</b></p>
              <ul>
                <li>Provide timely and accurate services as per SLA.</li>
                <li>Maintain all relevant licenses and certifications.</li>
                <li>Notify Med Bridge Afrik of delays, errors, or incidents.</li>
              </ul>
            </section>

            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>5. Data Privacy & Compliance</b></h2>
              <ul>
                <li>Compliance with data protection laws (e.g., HIPAA, GDPR).</li>
                <li>Encryption of all patient data in transit and at rest.</li>
                <li>Breach notification within 24 hours of discovery.</li>
              </ul>
            </section>

            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>6. Monitoring and Reporting</b></h2>
              <ul>
                <li>Monthly performance reports will be reviewed with third parties.</li>
                <li>KPIs tracked and addressed in case of SLA violations.</li>
              </ul>
            </section>

            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>7. Penalties for Non-Compliance</b></h2>
              <p>
                Failure to meet SLA targets may result in financial penalties or service reviews.
                Underperformance for three consecutive months may lead to termination.
              </p>
            </section>

            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>8. Termination Clause</b></h2>
              <p>
                Either party may terminate the agreement with 30 days’ notice, or immediately upon breach.
              </p>
            </section>

            <section className="border-b border-gray-200 pb-6 mb-8">
              <h2><b>9. Amendments</b></h2>
              <p>
                This SLA may be modified only through a signed agreement by both parties.
              </p>
            </section>

            <section className="pb-6 mb-4">
              <h2><b>10. Authorized Signatures</b></h2>
              <p>
                Med Bridge Afrik Ltd (CEO): Taye Ayeni<br />
                Country: Nigeria<br />
                <span className="flex items-center gap-2">
                  
                  Signature: <img
                    src="/images/tayelogo.png"
                    alt="Signature Logo"
                    className="w-12 h-auto"
                  />
                </span>
                <br />
                Date: {currentDate}
              </p>

              <p className="mt-6">
                {firstName} {lastName}<br />
                {pharmacyName}<br />
                Country: {country}<br />
                Signature: ________________________________<br />
                Date: {currentDate}
              </p>
            </section>
          </div>
        </div>
      </main>
      <Footer />
    </>
  );
}
