"use client";

import { useEffect, useMemo, useState } from "react";
import { apiGet, apiPost } from "@/lib/api";

type RuntimeStatus = "Ready" | "Check" | "Blocked" | "Locked";
type RuntimeRowStatus = "Active and watched" | "Pending env activation" | "Already active" | "Needs v460 approval" | "Rollback stopped" | "Guardrail blocked" | "Out of activation" | "Locked";

type RuntimeCheckRow = {
  key: string;
  label: string;
  status: RuntimeStatus;
  detail: string;
  firstFix: string;
  activationEffect: string;
};

type RuntimeSafetyWatchItem = {
  key: string;
  watch: string;
  status: RuntimeStatus;
  owner: string;
  instruction: string;
  evidenceNeeded: string;
};

type RuntimeActivationRow = {
  workspaceId: string;
  subscriptionId: string;
  workspaceName: string;
  workspaceSlug: string;
  workspaceTypeLabel: string;
  accountClassLabel: string;
  subscriptionStatus: string;
  planName: string;
  planStatus: string;
  providerSyncStatus: string;
  approvalStatus: string;
  dryRunStatus: string;
  activationStatus: string;
  rolloutScopeStatus: string;
  supportOutcomeStatus: string;
  closeoutStatus: string;
  safetyStatus: string;
  includedInActivation: boolean;
  configuredInRuntimeScope: boolean;
  approvedForActivation: boolean;
  alreadyInControlledScope: boolean;
  activeInRuntime: boolean;
  runtimeStatus: RuntimeRowStatus;
  runtimeEffect: string;
  currentPolicyMode: string;
  currentPolicyEffect: string;
  firstFix: string;
  safetyInstruction: string;
};

type EvidenceEvent = {
  id: string;
  action: string;
  recordedAt: string | null;
  recordedBy: string;
  summary: string;
  note: string;
  runtimeStatus: string;
  safetyStatus: string;
  activationLabel: string;
  activationCandidateCount: number;
  activeAndWatchedCount: number;
  pendingEnvActivationCount: number;
  blockedActivationCount: number;
};

type Review = {
  summary: {
    overallStatus: RuntimeStatus;
    activationLabel: string;
    totalReviewedWorkspaces: number;
    activationCandidateCount: number;
    activeAndWatchedCount: number;
    pendingEnvActivationCount: number;
    alreadyActiveCount: number;
    needsApprovalCount: number;
    rollbackStoppedCount: number;
    guardrailBlockedCount: number;
    lockedActivationCount: number;
    blockedActivationCount: number;
    outOfActivationCount: number;
    maxRuntimeWorkspaces: number;
    configuredRuntimeScopeCount: number;
    approvalReviewCount: number;
    approvalSwitchRecordCount: number;
    executionRecordCount: number;
    safetyWatchReviewCount: number;
    evidenceChainCount: number;
    canRecordExecution: boolean;
    canRecordSafetyWatch: boolean;
    exportRequired: boolean;
    runtimeActivationLive: boolean;
    firstFix: string;
  };
  environment: {
    runtimeActivationEnabled: boolean;
    runtimeActivationReviewOnly: boolean;
    recordingEnabled: boolean;
    safetyWatchEnabled: boolean;
    exportRequired: boolean;
    requireApprovalSwitchRecord: boolean;
    activationLabel: string;
    configuredRuntimeIdentifiers: string[];
    maxRuntimeWorkspaces: number;
    controlledActivationEnabled: boolean;
    controlledActivationReviewOnly: boolean;
    rollbackActive: boolean;
    broadHardBillingGatesEnabled: boolean;
    paymentCollectionEnabled: boolean;
    billingStatusMutationEnabled: boolean;
    customerPortalEnabled: boolean;
    brokerDistributionChanged: boolean;
    ownedPortalRulesChanged: boolean;
    internalLoadBoardAccessChanged: boolean;
  };
  checks: RuntimeCheckRow[];
  safetyWatch: RuntimeSafetyWatchItem[];
  activationRows: RuntimeActivationRow[];
  recentEvents: EvidenceEvent[];
};

function statusClasses(status: RuntimeStatus | RuntimeRowStatus | string) {
  if (status === "Ready" || status === "Active and watched" || status === "Already active") return "bg-emerald-100 text-emerald-700";
  if (status === "Blocked" || status === "Needs v460 approval" || status === "Rollback stopped" || status === "Guardrail blocked") return "bg-rose-100 text-rose-700";
  if (status === "Locked" || status === "Out of activation") return "bg-blue-100 text-blue-700";
  return "bg-amber-100 text-amber-700";
}

function dateTime(value?: string | null) {
  if (!value) return "Not recorded";
  return new Date(value).toLocaleString();
}

function csvEscape(value: unknown) {
  const text = String(value ?? "");
  if (/[",\n]/.test(text)) return `"${text.replace(/"/g, '""')}"`;
  return text;
}

function downloadCsv(filename: string, headers: string[], rows: unknown[][]) {
  const csv = [headers, ...rows].map((row) => row.map(csvEscape).join(",")).join("\n");
  const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
  const url = URL.createObjectURL(blob);
  const link = document.createElement("a");
  link.href = url;
  link.download = filename;
  document.body.appendChild(link);
  link.click();
  link.remove();
  URL.revokeObjectURL(url);
}

function rowText(row: RuntimeActivationRow) {
  return [
    row.workspaceName,
    row.workspaceSlug,
    row.workspaceTypeLabel,
    row.accountClassLabel,
    row.subscriptionStatus,
    row.planName,
    row.planStatus,
    row.providerSyncStatus,
    row.approvalStatus,
    row.dryRunStatus,
    row.runtimeStatus,
    row.runtimeEffect,
    row.currentPolicyMode,
    row.firstFix,
  ].join(" ").toLowerCase();
}

export function AdminHardBillingGateExpansionRuntimeActivationPanel() {
  const [review, setReview] = useState<Review | null>(null);
  const [loaded, setLoaded] = useState(false);
  const [error, setError] = useState<string | null>(null);
  const [filter, setFilter] = useState("activation");
  const [search, setSearch] = useState("");
  const [note, setNote] = useState("");
  const [saving, setSaving] = useState<"execution" | "safety-watch" | null>(null);

  async function loadReview() {
    const data = await apiGet<Review>("/api/admin/hard-billing-gates/expansion-runtime-activation");
    setReview(data);
  }

  useEffect(() => {
    let cancelled = false;
    async function load() {
      try {
        setError(null);
        const data = await apiGet<Review>("/api/admin/hard-billing-gates/expansion-runtime-activation");
        if (!cancelled) setReview(data);
      } catch (err: any) {
        if (!cancelled) setError(err?.message ?? "Failed to load hard billing gate expansion runtime activation execution.");
      } finally {
        if (!cancelled) setLoaded(true);
      }
    }
    void load();
    return () => {
      cancelled = true;
    };
  }, []);

  const needle = search.trim().toLowerCase();
  const rows = useMemo(() => {
    return (review?.activationRows ?? []).filter((row) => {
      const matchesFilter = filter === "all"
        || row.runtimeStatus === filter
        || row.approvalStatus === filter
        || row.dryRunStatus === filter
        || row.activationStatus === filter
        || (filter === "activation" && row.includedInActivation)
        || (filter === "configured" && row.configuredInRuntimeScope)
        || (filter === "active" && row.activeInRuntime)
        || (filter === "watched" && ["Active and watched", "Already active"].includes(row.runtimeStatus))
        || (filter === "pending" && row.runtimeStatus === "Pending env activation")
        || (filter === "blocked" && ["Needs v460 approval", "Rollback stopped", "Guardrail blocked", "Locked"].includes(row.runtimeStatus));
      const matchesSearch = !needle || rowText(row).includes(needle);
      return matchesFilter && matchesSearch;
    });
  }, [review, filter, needle]);

  async function recordEvidence(recordType: "execution" | "safety-watch") {
    try {
      setSaving(recordType);
      setError(null);
      const data = await apiPost<Review>("/api/admin/hard-billing-gates/expansion-runtime-activation", { note, recordType });
      setReview(data);
      setNote("");
    } catch (err: any) {
      setError(err?.message ?? "Failed to record hard billing gate expansion runtime activation evidence.");
      await loadReview().catch(() => undefined);
    } finally {
      setSaving(null);
    }
  }

  function exportActivationRows() {
    downloadCsv(
      "dispatchspot-hard-billing-gate-expansion-runtime-activation-rows.csv",
      ["Workspace", "Slug", "Workspace type", "Account class", "Included", "Configured", "Runtime status", "Active in runtime", "Current policy mode", "Approval status", "Dry-run status", "Activation packet", "Rollout scope", "Support outcome", "Closeout", "Safety", "Subscription", "Plan", "Plan status", "Provider sync", "Runtime effect", "First fix", "Safety instruction"],
      (review?.activationRows ?? []).map((row) => [
        row.workspaceName,
        row.workspaceSlug,
        row.workspaceTypeLabel,
        row.accountClassLabel,
        row.includedInActivation ? "Yes" : "No",
        row.configuredInRuntimeScope ? "Yes" : "No",
        row.runtimeStatus,
        row.activeInRuntime ? "Yes" : "No",
        row.currentPolicyMode,
        row.approvalStatus,
        row.dryRunStatus,
        row.activationStatus,
        row.rolloutScopeStatus,
        row.supportOutcomeStatus,
        row.closeoutStatus,
        row.safetyStatus,
        row.subscriptionStatus,
        row.planName,
        row.planStatus,
        row.providerSyncStatus,
        row.runtimeEffect,
        row.firstFix,
        row.safetyInstruction,
      ]),
    );
  }

  function exportSafetyWatch() {
    downloadCsv(
      "dispatchspot-hard-billing-gate-expansion-immediate-safety-watch.csv",
      ["Watch item", "Status", "Owner", "Instruction", "Evidence needed"],
      (review?.safetyWatch ?? []).map((item) => [item.watch, item.status, item.owner, item.instruction, item.evidenceNeeded]),
    );
  }

  function exportHistory() {
    downloadCsv(
      "dispatchspot-hard-billing-gate-expansion-runtime-activation-history.csv",
      ["Recorded at", "Recorded by", "Action", "Runtime status", "Safety status", "Activation label", "Candidates", "Active and watched", "Pending env activation", "Blocked", "Summary", "Note"],
      (review?.recentEvents ?? []).map((event) => [
        dateTime(event.recordedAt),
        event.recordedBy,
        event.action,
        event.runtimeStatus,
        event.safetyStatus,
        event.activationLabel,
        event.activationCandidateCount,
        event.activeAndWatchedCount,
        event.pendingEnvActivationCount,
        event.blockedActivationCount,
        event.summary,
        event.note,
      ]),
    );
  }

  if (!loaded) {
    return <section className="rounded-3xl border border-slate-200 bg-white p-6 shadow-sm"><p className="text-sm text-slate-500">Loading hard billing gate expansion runtime activation execution…</p></section>;
  }

  if (!review) {
    return <section className="rounded-3xl border border-rose-200 bg-rose-50 p-6"><p className="text-sm text-rose-700">{error ?? "Hard billing gate expansion runtime activation execution is unavailable."}</p></section>;
  }

  const summary = review.summary;
  const env = review.environment;

  return (
    <section className="space-y-5 rounded-3xl border border-slate-200 bg-white p-6 shadow-sm">
      <div className="flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between">
        <div>
          <p className="text-xs font-semibold uppercase tracking-wide text-slate-500">v461 controlled expansion runtime</p>
          <h2 className="mt-1 text-xl font-semibold text-slate-950">Controlled hard-gate expansion runtime activation and immediate safety watch</h2>
          <p className="mt-2 max-w-3xl text-sm text-slate-600">
            Super Admin can review the exact v460-approved workspaces now allowed into controlled hard-gate runtime scope and record the immediate safety watch. This can expand controlled hard-gate behavior for configured workspace identifiers only. It does not collect payment, mutate billing status, activate broad hard gates, change broker distribution, change owned portal rules, or open internal load-board access.
          </p>
        </div>
        <span className={`rounded-full px-3 py-1 text-xs font-semibold ${statusClasses(summary.overallStatus)}`}>{summary.overallStatus}</span>
      </div>

      {error ? <div className="rounded-2xl border border-rose-200 bg-rose-50 p-3 text-sm text-rose-700">{error}</div> : null}

      <div className="grid gap-3 md:grid-cols-2 xl:grid-cols-5">
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <p className="text-xs uppercase tracking-wide text-slate-500">Activation label</p>
          <p className="mt-1 text-lg font-semibold text-slate-950">{summary.activationLabel}</p>
        </div>
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <p className="text-xs uppercase tracking-wide text-slate-500">Runtime candidates</p>
          <p className="mt-1 text-lg font-semibold text-slate-950">{summary.activationCandidateCount}</p>
          <p className="text-xs text-slate-500">Max {summary.maxRuntimeWorkspaces}</p>
        </div>
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <p className="text-xs uppercase tracking-wide text-slate-500">Active and watched</p>
          <p className="mt-1 text-lg font-semibold text-slate-950">{summary.activeAndWatchedCount}</p>
          <p className="text-xs text-slate-500">{summary.pendingEnvActivationCount} pending env activation</p>
        </div>
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <p className="text-xs uppercase tracking-wide text-slate-500">Blocked / locked</p>
          <p className="mt-1 text-lg font-semibold text-slate-950">{summary.blockedActivationCount}</p>
          <p className="text-xs text-slate-500">{summary.alreadyActiveCount} already active</p>
        </div>
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <p className="text-xs uppercase tracking-wide text-slate-500">Evidence chain</p>
          <p className="mt-1 text-lg font-semibold text-slate-950">{summary.evidenceChainCount}</p>
          <p className="text-xs text-slate-500">{summary.safetyWatchReviewCount} safety watch records</p>
        </div>
      </div>

      <div className="rounded-2xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-800">
        <p className="font-semibold">First fix: {summary.firstFix}</p>
        <p className="mt-1 text-xs">
          Runtime activation {env.runtimeActivationEnabled ? "on" : "locked"}; review-only {env.runtimeActivationReviewOnly ? "on" : "off"}; recording {env.recordingEnabled ? "on" : "locked"}; safety watch {env.safetyWatchEnabled ? "on" : "locked"}. Controlled activation {env.controlledActivationEnabled ? "on" : "off"}; controlled review-only {env.controlledActivationReviewOnly ? "on" : "off"}; rollback stop {env.rollbackActive ? "on" : "off"}. Broad hard gates {env.broadHardBillingGatesEnabled ? "on" : "off"}; payment collection {env.paymentCollectionEnabled ? "on" : "off"}; billing status mutation {env.billingStatusMutationEnabled ? "on" : "off"}; customer portal {env.customerPortalEnabled ? "on" : "off"}.
        </p>
      </div>

      <div className="grid gap-3 md:grid-cols-2 xl:grid-cols-4">
        {review.checks.map((item) => (
          <div key={item.key} className="rounded-2xl border border-slate-200 p-4">
            <div className="flex items-center justify-between gap-2">
              <p className="text-sm font-semibold text-slate-900">{item.label}</p>
              <span className={`rounded-full px-2 py-1 text-[11px] font-semibold ${statusClasses(item.status)}`}>{item.status}</span>
            </div>
            <p className="mt-2 text-xs text-slate-600">{item.detail}</p>
            <p className="mt-2 text-xs font-medium text-slate-700">{item.firstFix}</p>
            <p className="mt-2 text-[11px] text-slate-500">{item.activationEffect}</p>
          </div>
        ))}
      </div>

      <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
        <div className="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between">
          <div>
            <h3 className="text-sm font-semibold text-slate-950">Immediate safety watch</h3>
            <p className="mt-1 text-xs text-slate-500">This checklist confirms v460 approval evidence, runtime identifiers, active controlled scope, rollback stop availability, and downstream guardrails.</p>
          </div>
          <button className="rounded-xl border border-slate-300 bg-white px-3 py-2 text-xs font-semibold text-slate-700 hover:bg-slate-100" onClick={exportSafetyWatch}>Export safety watch</button>
        </div>
        <div className="mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-3">
          {review.safetyWatch.map((item) => (
            <div key={item.key} className="rounded-xl border border-slate-200 bg-white p-4 text-xs text-slate-600">
              <div className="flex items-center justify-between gap-2">
                <p className="font-semibold text-slate-900">{item.watch}</p>
                <span className={`rounded-full px-2 py-1 text-[11px] font-semibold ${statusClasses(item.status)}`}>{item.status}</span>
              </div>
              <p className="mt-1 text-slate-500">Owner: {item.owner}</p>
              <p className="mt-2">{item.instruction}</p>
              <p className="mt-2 font-medium text-slate-700">{item.evidenceNeeded}</p>
            </div>
          ))}
        </div>
      </div>

      <div className="flex flex-col gap-3 rounded-2xl border border-slate-200 bg-slate-50 p-4 lg:flex-row lg:items-center lg:justify-between">
        <div className="flex flex-wrap gap-2">
          <select className="rounded-xl border border-slate-300 bg-white px-3 py-2 text-sm" value={filter} onChange={(event) => setFilter(event.target.value)}>
            <option value="activation">Included in activation</option>
            <option value="watched">Active or already active</option>
            <option value="pending">Pending env activation</option>
            <option value="active">Active in runtime</option>
            <option value="blocked">Blocked or locked</option>
            <option value="configured">Configured runtime scope</option>
            <option value="all">All reviewed rows</option>
            <option value="Active and watched">Active and watched</option>
            <option value="Already active">Already active</option>
            <option value="Pending env activation">Pending env activation</option>
            <option value="Needs v460 approval">Needs v460 approval</option>
            <option value="Rollback stopped">Rollback stopped</option>
            <option value="Guardrail blocked">Guardrail blocked</option>
            <option value="Out of activation">Out of activation</option>
            <option value="Locked">Locked</option>
          </select>
          <input
            className="min-w-[260px] rounded-xl border border-slate-300 bg-white px-3 py-2 text-sm"
            placeholder="Search workspace, runtime status, policy mode…"
            value={search}
            onChange={(event) => setSearch(event.target.value)}
          />
        </div>
        <div className="flex flex-wrap gap-2">
          <button className="rounded-xl border border-slate-300 bg-white px-3 py-2 text-xs font-semibold text-slate-700 hover:bg-slate-100" onClick={exportActivationRows}>Export activation rows</button>
          <button className="rounded-xl border border-slate-300 bg-white px-3 py-2 text-xs font-semibold text-slate-700 hover:bg-slate-100" onClick={exportHistory}>Export evidence history</button>
        </div>
      </div>

      <div className="overflow-x-auto rounded-2xl border border-slate-200">
        <table className="min-w-full divide-y divide-slate-200 text-sm">
          <thead className="bg-slate-50 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">
            <tr>
              <th className="px-4 py-3">Workspace</th>
              <th className="px-4 py-3">Runtime result</th>
              <th className="px-4 py-3">Source evidence</th>
              <th className="px-4 py-3">Safety instruction</th>
            </tr>
          </thead>
          <tbody className="divide-y divide-slate-200 bg-white">
            {rows.map((row) => (
              <tr key={`${row.workspaceId}-${row.subscriptionId}`} className="align-top">
                <td className="px-4 py-3">
                  <p className="font-semibold text-slate-950">{row.workspaceName}</p>
                  <p className="text-xs text-slate-500">/{row.workspaceSlug}</p>
                  <p className="text-xs text-slate-500">{row.workspaceTypeLabel} · {row.accountClassLabel}</p>
                </td>
                <td className="px-4 py-3">
                  <span className={`rounded-full px-2 py-1 text-[11px] font-semibold ${statusClasses(row.runtimeStatus)}`}>{row.runtimeStatus}</span>
                  <p className="mt-2 text-xs text-slate-600">{row.runtimeEffect}</p>
                  <p className="text-xs text-slate-500">Active in runtime: {row.activeInRuntime ? "yes" : "no"}</p>
                  <p className="text-xs text-slate-500">Current policy: {row.currentPolicyMode}</p>
                </td>
                <td className="px-4 py-3 text-xs text-slate-600">
                  <p>Approval: {row.approvalStatus}</p>
                  <p>Dry run: {row.dryRunStatus}</p>
                  <p>Activation packet: {row.activationStatus}</p>
                  <p>Rollout: {row.rolloutScopeStatus}</p>
                  <p>Support: {row.supportOutcomeStatus}</p>
                  <p>Closeout: {row.closeoutStatus}</p>
                  <p>Safety: {row.safetyStatus}</p>
                  <p>{row.subscriptionStatus} · {row.planName}</p>
                </td>
                <td className="px-4 py-3 text-xs leading-5 text-slate-600">
                  <p className="font-medium text-slate-700">{row.safetyInstruction}</p>
                  <p className="mt-2 text-slate-500">{row.firstFix}</p>
                  <p className="mt-2 text-slate-500">{row.currentPolicyEffect}</p>
                </td>
              </tr>
            ))}
            {!rows.length ? (
              <tr>
                <td className="px-4 py-6 text-center text-sm text-slate-500" colSpan={4}>No runtime activation rows match this filter.</td>
              </tr>
            ) : null}
          </tbody>
        </table>
      </div>

      <div className="grid gap-4 lg:grid-cols-[1fr_2fr]">
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <h3 className="text-sm font-semibold text-slate-950">Record runtime activation evidence</h3>
          <p className="mt-1 text-xs text-slate-500">Recording evidence does not collect payment, mutate billing status, activate broad hard gates, or change broker, portal, or load-board access.</p>
          <textarea
            className="mt-3 min-h-[92px] w-full rounded-xl border border-slate-300 px-3 py-2 text-sm"
            placeholder="Optional runtime activation or safety watch note"
            value={note}
            onChange={(event) => setNote(event.target.value)}
          />
          <div className="mt-3 flex flex-wrap gap-2">
            <button
              className="rounded-xl bg-slate-950 px-4 py-2 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:bg-slate-300"
              disabled={Boolean(saving) || !summary.canRecordExecution}
              onClick={() => recordEvidence("execution")}
            >
              {saving === "execution" ? "Recording…" : "Record runtime execution"}
            </button>
            <button
              className="rounded-xl border border-slate-300 bg-white px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-100 disabled:cursor-not-allowed disabled:border-slate-200 disabled:text-slate-400"
              disabled={Boolean(saving) || !summary.canRecordSafetyWatch}
              onClick={() => recordEvidence("safety-watch")}
            >
              {saving === "safety-watch" ? "Recording…" : "Record safety watch"}
            </button>
          </div>
          {!summary.canRecordExecution || !summary.canRecordSafetyWatch ? <p className="mt-2 text-xs text-slate-500">Runtime activation, recording, or safety watch is locked by environment flag.</p> : null}
        </div>
        <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4">
          <h3 className="text-sm font-semibold text-slate-950">Recent runtime activation evidence</h3>
          <div className="mt-3 grid gap-2 md:grid-cols-2">
            {(review.recentEvents ?? []).slice(0, 8).map((event) => (
              <div key={event.id} className="rounded-xl border border-slate-200 bg-white p-3 text-xs text-slate-600">
                <p className="font-semibold text-slate-900">{event.summary}</p>
                <p>{dateTime(event.recordedAt)} by {event.recordedBy}</p>
                <p>{event.action}</p>
                <p>Runtime: {event.runtimeStatus || "not set"} · Safety: {event.safetyStatus || "not set"}</p>
                <p>Scope: {event.activationLabel || "not set"} · Candidates: {event.activationCandidateCount} · Active: {event.activeAndWatchedCount} · Pending: {event.pendingEnvActivationCount} · Blocked: {event.blockedActivationCount}</p>
                {event.note ? <p className="mt-1 text-slate-700">{event.note}</p> : null}
              </div>
            ))}
            {!review.recentEvents.length ? <p className="text-xs text-slate-500">No runtime activation evidence has been recorded yet.</p> : null}
          </div>
        </div>
      </div>
    </section>
  );
}
