"use client";

import ConfirmModal from "../common/ConfirmModal";

export default function CategoryStatusModal({
  open,
  action,
  loading = false,
  onClose,
  onConfirm,
}: {
  open: boolean;
  action: "inactivate" | "activate";
  loading?: boolean;
  onClose: () => void;
  onConfirm: () => void;
}) {
  const isInactivate = action === "inactivate";

  return (
    <ConfirmModal
      open={open}
      title={isInactivate ? "Inactivate Category?" : "Activate Category?"}
      description={
        isInactivate
          ? "Are you sure you want to inactivate this category? All products associated with this category will also be marked as inactive and will no longer be visible to users."
          : "Are you sure you want to activate this category? All associated products will also be activated and made available on the platform."
      }
      confirmLabel={
        loading
          ? "Please wait..."
          : isInactivate
          ? "Confirm Inactivate"
          : "Confirm Activate"
      }
      confirmDisabled={loading}
      confirmButtonClassName={
        isInactivate ? "bg-[#DC2626] hover:bg-[#B91C1C]" : "bg-[#16A34A] hover:bg-[#15803D]"
      }
      onClose={onClose}
      onConfirm={onConfirm}
      width="440px"
    />
  );
}
