import React from 'react'
import { Badge } from 'flowbite-react'
import { FiCheckCircle, FiClock, FiExternalLink, FiUser } from 'react-icons/fi'

import { formatToMYT } from '@/lib/utils/date'

interface FollowUpDetailsProps {
  followUp: FollowUp
}

export default function FollowUpDetails({ followUp }: FollowUpDetailsProps) {
  return (
    <section className="mt-8 max-w-6xl">
      <div className="relative overflow-hidden rounded-2xl border border-green-200 bg-gradient-to-br from-green-50 via-white to-emerald-50 p-6 shadow-sm">
        <div
          className="absolute -right-10 -top-10 h-36 w-36 rounded-full bg-green-100/70"
          aria-hidden="true"
        />

        <div className="relative">
          <div className="flex flex-wrap items-center gap-3">
            <div className="flex h-11 w-11 items-center justify-center rounded-full bg-green-600 text-white shadow-md shadow-green-200">
              <FiCheckCircle className="h-5 w-5" />
            </div>

            <div>
              <h3 className="text-xl font-semibold text-green-950">
                Follow Up Details
              </h3>
              <p className="text-sm font-medium text-green-700">
                Follow-up has been successfully recorded.
              </p>
            </div>

            <Badge color="success" className="sm:ml-auto">
              Follow-Up Completed
            </Badge>
          </div>

          <div className="mt-6 grid grid-cols-1 gap-4 sm:grid-cols-3">
            <div className="rounded-xl border border-green-100 bg-white/80 p-4">
              <div className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-green-700">
                <FiClock className="h-4 w-4" />
                Follow Up Time
              </div>
              <p className="mt-2 text-sm font-semibold text-slate-900">
                {formatToMYT(
                  followUp.followed_up_at,
                  "MMMM dd, yyyy 'at' HH:mm",
                )}
              </p>
            </div>

            <div className="rounded-xl border border-green-100 bg-white/80 p-4">
              <div className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-green-700">
                <FiExternalLink className="h-4 w-4" />
                Follow Up Link
              </div>
              <a
                href={followUp.evidence_url}
                target="_blank"
                rel="noreferrer noopener"
                className="mt-2 block break-all text-sm font-semibold text-blue-600 hover:underline"
              >
                {followUp.evidence_url}
              </a>
            </div>

            <div className="rounded-xl border border-green-100 bg-white/80 p-4">
              <div className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-green-700">
                <FiUser className="h-4 w-4" />
                Officer
              </div>
              <p className="mt-2 text-sm font-semibold text-slate-900">
                {followUp.officer?.name ?? 'N/A'}
              </p>
            </div>
          </div>
        </div>
      </div>
    </section>
  )
}
