"use client";

import Image from "next/image";
import { AdminBreadcrumb } from "@/components/admin/admin-breadcrumb";
import { Card, CardContent } from "@/components/ui/card";
import { useLanguage } from "@/lib/i18n";

type ComingSoonModule = "id-cards" | "certifications" | "notifications";

interface ComingSoonPageProps {
  module?: string | null;
}

const moduleBreadcrumbs: Record<
  ComingSoonModule,
  {
    currentKey: Parameters<ReturnType<typeof useLanguage>["t"]>[0];
    parent?: string;
    parentHref?: string;
  }
> = {
  "id-cards": {
    currentKey: "admin.idCards",
  },
  certifications: {
    currentKey: "admin.certifications",
  },
  notifications: {
    currentKey: "admin.notifications",
    parent: "Settings",
    parentHref: "/admin/settings",
  },
};

function isComingSoonModule(
  module?: string | null,
): module is ComingSoonModule {
  return (
    module === "id-cards" ||
    module === "certifications" ||
    module === "notifications"
  );
}

export function ComingSoonPage({ module }: ComingSoonPageProps) {
  const { t } = useLanguage();
  const breadcrumb = isComingSoonModule(module)
    ? moduleBreadcrumbs[module]
    : { currentKey: "admin.comingSoon" as const };

  return (
    <div className="space-y-4">
      <AdminBreadcrumb
        current={t(breadcrumb.currentKey)}
        parent={breadcrumb.parent}
        parentHref={breadcrumb.parentHref}
      />

      <Card className="overflow-hidden rounded-2xl border-[var(--theme-border-soft)] bg-white py-0 shadow-sm">
        <CardContent className="flex min-h-[430px] items-center justify-center bg-[linear-gradient(180deg,#ffffff_0%,var(--theme-surface)_100%)] px-5 py-14 text-center">
          <div className="flex max-w-md flex-col items-center">
            <div className="relative mb-0 h-24 w-32">
              <Image
                src="/placeholder.png"
                alt=""
                fill
                className="object-contain"
                priority
              />
            </div>

            <h1 className="text-5xl font-black text-foreground">
              {t("admin.comingSoonTitle")}
            </h1>

            <p className="mt-3 max-w-xs text-sm leading-6 text-muted-foreground">
              {t("admin.comingSoonDescription")}
            </p>

            <p className="mt-0 max-w-xs text-xs font-medium leading-5 text-muted-foreground">
              {t("admin.stayTunedDescription")}
            </p>
          </div>
        </CardContent>
      </Card>
    </div>
  );
}
