"use client";

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { ALL_PAGES_ADMIN } from "@/lib/strings";
import type { AdminPageItem } from "./all-pages-table";

interface DeleteStaticPageDialogProps {
  page: AdminPageItem | null;
  open: boolean;
  onOpenChange: (open: boolean) => void;
  onConfirm: () => void;
}

export function DeleteStaticPageDialog({
  page,
  open,
  onOpenChange,
  onConfirm,
}: DeleteStaticPageDialogProps) {
  return (
    <AlertDialog open={open} onOpenChange={onOpenChange}>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>{ALL_PAGES_ADMIN.DELETE_PAGE}</AlertDialogTitle>
          <AlertDialogDescription>
            {ALL_PAGES_ADMIN.DELETE_PAGE_CONFIRM}
            {page?.name && (
              <>
                {" "}
                (Page: <strong>{page.name}</strong>)
              </>
            )}
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel>{ALL_PAGES_ADMIN.DIALOG_CANCEL}</AlertDialogCancel>
          <AlertDialogAction
            onClick={onConfirm}
            className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
          >
            {ALL_PAGES_ADMIN.DELETE_CONFIRM_BUTTON}
          </AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}
