/**
 * 廠商刪除確認對話框
 */

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
} from "../ui/alert-dialog";
import type { Supplier } from "../../types/vendor";

interface VendorDeleteDialogProps {
  open: boolean;
  supplier: Supplier | null;
  onConfirm: () => void;
  onCancel: () => void;
}

export default function VendorDeleteDialog({
  open,
  supplier,
  onConfirm,
  onCancel,
}: VendorDeleteDialogProps) {
  return (
    <AlertDialog open={open} onOpenChange={onCancel}>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>確認刪除廠商</AlertDialogTitle>
          <AlertDialogDescription>
            確定要刪除 {supplier?.name} 廠商嗎？此操作無法撤銷。
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel
            size="sm"
            className="gap-2 button-outlined-primary"
          >
            取消
          </AlertDialogCancel>
          <AlertDialogAction
            size="sm"
            className="gap-2 button-filled-error"
            onClick={onConfirm}
          >
            刪除
          </AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}
