import { h } from "@stencil/core";
import { GenericTableView } from "../../tables/GenericTableView";
import { SourceCellReferral, DateCell } from "./RewardsTableCell.stories";
import { StatusCellPayoutSent, StatusCellPayoutFailed, StatusCellPendingNewTaxForm, StatusCellPendingPartnerCreation, StatusCellPendingTaxReview, StatusCellPendingTaxSubmission, StatusCellPayoutProcessing, CashReward, StatusCellPendingW9, StatusCellPayoutCancelled, } from "./TaxAndCashRewardsTableCell.stories";
export default {
  title: "Components/Tax And Cash Rewards Table",
};
const rewardsTableProps = (rows, empty = false, loading = false, prev = "Prev", next = "Next", hidden = "") => ({
  states: {
    hasPrev: false,
    hasNext: true,
    show: empty
      ? "empty"
      : loading
        ? "loading"
        : "rows",
    namespace: "sqm-rewards-table",
  },
  data: {
    textOverrides: {
      showLabels: true,
      prevLabel: prev,
      moreLabel: next,
    },
    hiddenColumns: hidden,
    mdBreakpoint: 799,
    smBreakpoint: 599,
  },
  callbacks: {
    prevPage: () => console.log("Prev"),
    nextPage: () => console.log("Next"),
  },
  elements: {
    columns: ["Rewards", "Status", "Source", "Date received"],
    rows: rows,
  },
});
/* -------------------------------------------------------------------------- */
/* PENDING ROWS                                */
/* -------------------------------------------------------------------------- */
const r_pending_new_tax_form = [
  h(CashReward, null),
  h(StatusCellPendingNewTaxForm, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
const r_pending_tax_submission = [
  h(CashReward, null),
  h(StatusCellPendingTaxSubmission, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
const r_pending_tax_review = [
  h(CashReward, null),
  h(StatusCellPendingTaxReview, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
const r_pending_partner_creation = [
  h(CashReward, null),
  h(StatusCellPendingPartnerCreation, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
const r_pending_w9 = [
  h(CashReward, null),
  h(StatusCellPendingW9, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
/* -------------------------------------------------------------------------- */
/* SUCCESS / PROCESSING ROWS                                                  */
/* -------------------------------------------------------------------------- */
const r_payout_sent = [
  h(CashReward, null),
  h(StatusCellPayoutSent, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
const r_payout_processing = [
  h(CashReward, null),
  h(StatusCellPayoutProcessing, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
/* -------------------------------------------------------------------------- */
/* ERROR / CANCELLED ROWS                                                     */
/* -------------------------------------------------------------------------- */
const r_payout_failed = [
  h(CashReward, null),
  h(StatusCellPayoutFailed, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
const r_payout_cancelled = [
  h(CashReward, null),
  h(StatusCellPayoutCancelled, null),
  h(SourceCellReferral, null),
  h(DateCell, null),
];
export const RewardsTable = () => {
  return (h(GenericTableView, Object.assign({}, rewardsTableProps([
    r_pending_new_tax_form,
    r_pending_tax_submission,
    r_pending_tax_review,
    r_pending_partner_creation,
    r_pending_w9,
    r_payout_processing,
    r_payout_sent,
    r_payout_failed,
    r_payout_cancelled,
  ]))));
};
