import { h } from "@stencil/core";
import { convertToLocal } from "../../utils/utils";
import { MapPayoutStatusToBadge } from "./payouts-status";
import { getAlternateTableCellPart, tableHeadCell } from "../../styles/parts";
export const defaultColumnsKeys = 'created_at,amount,status,payments_total,refunds_total,fees_total,other_total,csv';
export const payoutTableColumns = {
    created_at: () => (h("th", { part: tableHeadCell, scope: "col", title: "The date the payout was deposited" }, "Created")),
    sub_account_name: () => (h("th", { part: tableHeadCell, scope: "col", title: "The sub account associated with the payout" }, "Sub Account")),
    payments_total: () => (h("th", { part: tableHeadCell, scope: "col", title: "The total payments amount associated with the payout" }, "Payments")),
    refunds_total: () => (h("th", { part: tableHeadCell, scope: "col", title: "The total refunds amount associated with the payout" }, "Refunds")),
    fees_total: () => (h("th", { part: tableHeadCell, scope: "col", title: "The total fees amount associated with the payout" }, "Fees")),
    other_total: () => (h("th", { part: tableHeadCell, scope: "col", title: "The total other amount" }, "Other")),
    amount: () => (h("th", { part: tableHeadCell, scope: "col", title: "The total amount of the payout" }, "Amount")),
    status: () => (h("th", { part: tableHeadCell, scope: "col", title: "The real-time status of each payout" }, "Status")),
    csv: () => (h("th", { part: tableHeadCell, scope: "col", title: "Export CSV" })),
};
export const payoutTableCells = (downloadCSV) => ({
    created_at: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, h("div", { class: "fw-bold" }, convertToLocal(payout.created_at, { showDisplayDate: true })))),
    sub_account_name: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, payout.sub_account_name)),
    payments_total: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, payout.formattedPaymentAmount(payout.payments_total))),
    refunds_total: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, payout.formattedPaymentAmount(payout.refunds_total))),
    fees_total: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, payout.formattedPaymentAmount(payout.fees_total))),
    other_total: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, payout.formattedPaymentAmount(payout.other_total))),
    amount: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, payout.formattedPaymentAmount(payout.amount))),
    status: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, MapPayoutStatusToBadge(payout.status))),
    csv: (payout, index) => (h("td", { part: getAlternateTableCellPart(index) }, h("a", { href: "#", onClick: (event) => { event.preventDefault(); downloadCSV(payout.id); } }, "CSV"))),
});
