import { ActionItem } from "@/types/table";
import { ProjectCharge } from "@/types/paymentPlans";
import { PROJECT_CHARGE_ACTION_TYPE } from "./projectCharges";

const { EDIT, DUPLICATE, DELETE } = PROJECT_CHARGE_ACTION_TYPE;

export function createProjectChargeActions(
  handleChargeAction: (actionType: string, charge: ProjectCharge) => void
): ActionItem[] {
  return [
    {
      label: "Edit Charge",
      onClick: (charge) => handleChargeAction(EDIT, charge),
    },
    {
      label: "Duplicate Charge",
      onClick: (charge) => handleChargeAction(DUPLICATE, charge),
    },
    {
      divider: true,
      label: "Delete Charge",
      onClick: (charge) => handleChargeAction(DELETE, charge),
      isDanger: true,
    },
  ];
}
