import {
  DateCell
} from "./chunk-25LYVP3C.js";
import {
  getStylizedAmount
} from "./chunk-PXYDR7WQ.js";

// src/hooks/table/columns/use-payout-table-columns.tsx
import { StatusBadge } from "@medusajs/ui";
import { createColumnHelper } from "@tanstack/react-table";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { jsx } from "react/jsx-runtime";
var columnHelper = createColumnHelper();
var payoutStatusColor = (status) => {
  switch (status) {
    case "paid":
      return "green";
    case "processing":
      return "orange";
    case "pending":
      return "grey";
    case "failed":
    case "canceled":
      return "red";
    default:
      return "grey";
  }
};
var usePayoutTableColumns = () => {
  const { t } = useTranslation();
  return useMemo(
    () => [
      columnHelper.accessor("display_id", {
        header: t("fields.id"),
        cell: ({ getValue }) => `#${getValue()}`
      }),
      columnHelper.accessor("status", {
        header: t("fields.status"),
        cell: ({ getValue }) => {
          const status = getValue();
          const label = status.charAt(0).toUpperCase() + status.slice(1);
          return /* @__PURE__ */ jsx(StatusBadge, { color: payoutStatusColor(status), children: label });
        }
      }),
      columnHelper.accessor("amount", {
        header: t("fields.amount"),
        cell: ({ getValue, row }) => getStylizedAmount(getValue(), row.original.currency_code)
      }),
      columnHelper.accessor("created_at", {
        header: t("fields.createdAt"),
        cell: ({ getValue }) => /* @__PURE__ */ jsx(DateCell, { date: getValue() })
      })
    ],
    [t]
  );
};

export {
  usePayoutTableColumns
};
