"use client";

import { Trash2 } from "lucide-react";

interface Props {
  appId: number;
  appName: string;
  deleteAction: (formData: FormData) => Promise<void>;
}

export default function DeleteButton({ appId, appName, deleteAction }: Props) {
  return (
    <form action={deleteAction}>
      <input type="hidden" name="id" value={appId} />
      <button
        type="submit"
        onClick={(e) => {
          if (!confirm(`"${appName}" silinsin mi? Bu işlem geri alınamaz.`)) {
            e.preventDefault();
          }
        }}
        className="flex items-center gap-1.5 px-3 py-2 bg-red-50 dark:bg-red-900/10 text-red-500 border border-red-200 dark:border-red-900 rounded-xl text-xs font-bold hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors"
      >
        <Trash2 size={13} /> Sil
      </button>
    </form>
  );
}
