import { h } from "@stencil/core";
import scenario1 from "./columns/sqm-rewards-table-date-column.feature";
import scenario2 from "./columns/sqm-rewards-table-reward-column.feature";
import scenario4 from "./columns/sqm-rewards-table-source-column.feature";
import scenario3 from "./columns/sqm-rewards-table-status-column.feature";
const scenario = scenario1 + scenario2 + scenario3 + scenario4;
export default {
  title: "Components/Rewards Table Cell",
  parameters: {
    scenario,
  },
};
const rewardsData = {
  id: "61c100117a82a376d8804166",
  type: "CREDIT",
  value: 19,
  unit: "Points",
  name: null,
  dateGiven: 1640038417468,
  meta: { message: "***CUSTOMER NOTE MESSAGE***" },
  dateExpires: null,
  dateCancelled: null,
  dateRedeemed: null,
  dateScheduledFor: null,
  fuelTankCode: null,
  fuelTankType: null,
  currency: null,
  prettyValue: "19 Points",
  prettyValueNumber: "19",
  prettyAvailableNumber: "19",
  prettyRedeemedNumber: "0",
  statuses: ["AVAILABLE", "PENDING"],
  pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
  globalRewardKey: null,
  rewardSource: "MANUAL",
  prettyRedeemedCredit: "0 Points",
  prettyAssignedCredit: "19 Points",
  prettyAvailableValue: "19 Points",
  exchangedRewardRedemptionTransaction: null,
  referral: null,
  rewardRedemptionTransactions: {
    data: null,
  },
  partnerFundsTransfer: null,
};
const cashReward = {
  id: "68c34fd98a6cb4f5f8394084",
  type: "CREDIT",
  value: 59900,
  prettyValue: "$599.00",
  availableValue: 0,
  prettyAvailableValue: "$0.00",
  prettyAssignedCredit: "$599.00",
  prettyRedeemedCredit: "$599.00",
  prettyValueNumber: "599",
  prettyAvailableNumber: "0",
  prettyRedeemedNumber: "599",
  unit: "CASH/USD",
  baseUnit: "CASH",
  rewardUnit: {
    key: "CASH/USD",
    name: "Cash",
  },
  name: null,
  dateCreated: 1757630425085,
  dateScheduledFor: 1757631025115,
  dateGiven: 1757630737115,
  dateExpires: null,
  dateCancelled: null,
  dateRedeemed: 1757630737115,
  dateModified: 1757630737115,
  rewardSource: "MANUAL",
  fuelTankCode: null,
  fuelTankType: null,
  fuelTankSyncSetting: null,
  currency: "USD",
  meta: null,
  programId: "40444",
  programRewardKey: null,
  globalRewardKey: "cash",
  program: {
    id: "40444",
    name: "Make Money Program",
    template: {
      id: "2qdmAx1fi31deo3P9O36sQ",
      name: "Referral Program With Objectives",
    },
  },
  partnerFundsTransfer: {
    id: "693503",
    status: "TRANSFERRED",
    dateScheduled: 1768583958000,
    dateTransferred: 1768583958000,
    dateCreated: 1767979159000,
  },
  user: {
    id: "8da2c67e05e3e56de7ea638c2705017945211621c80e1cd4b4aac0e423d1cdb2",
    accountId: "8da2c67e05e3e56de7ea638c2705017945211621c80e1cd4b4aac0e423d1cdb2",
    firstName: "Billy",
    lastName: "Jean",
    email: "billy.jean@impact.com",
    impactConnection: {
      connected: true,
      taxHandlingEnabled: true,
      publisher: null,
    },
  },
  referral: null,
  description: null,
  statuses: ["REDEEMED"],
  // rewardRedemptionTransactions: {
  //   data: [
  //     {
  //       exchangedRewards: {
  //         data: [],
  //       },
  //       redeemedRewards: {
  //         data: [
  //           {
  //             prettyValue: "$599.00",
  //           },
  //         ],
  //       },
  //       creditRedeemed: 59900,
  //       prettyRedeemedCredit: "$599.00",
  //       dateRedeemed: 1757630737115,
  //     },
  //   ],
  // },
  rewardRedemptionTransactions: {
    data: null,
  },
  exchangedRewardRedemptionTransaction: null,
  pendingReasons: [],
};
const taxConnection = {
  connected: true,
  taxHandlingEnabled: true,
  publisher: {
    requiredTaxDocumentType: "W8BEN",
    currentTaxDocument: {
      status: "NOT_VERIFIED",
      type: "W8BEN",
      dateCreated: 321321487,
    },
    withdrawalSettings: {
      paymentMethod: "BANK_TRANSFER",
    },
    payoutsAccount: null,
  },
};
export const RewardsCellCreditSingle = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...singleRedeemed } }));
};
export const RewardsCellCreditFull = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData }, availableText: "{availableAmount} remaining" }));
};
const partial = {
  prettyAvailableValue: "10 Points",
  prettyRedeemedCredit: "9 Points",
  prettyRedeemedNumber: "9",
  dateRedeemed: 1640038417468,
};
export const RewardsCellCreditPartial = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...partial }, availableText: "{availableAmount} remaining" }));
};
export const RewardsCellCreditCancelled = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...cancelled }, redeemedText: "{redeemedAmount} redeemed" }));
};
export const RewardsCellCreditExpired = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...partial, ...expired }, redeemedText: "{redeemedAmount} redeemed" }));
};
export const RewardsCellCreditPending = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...pending }, availableText: "{availableAmount} remaining" }));
};
const empty = {
  prettyAvailableValue: "0 Points",
  prettyAvailableNumber: "0",
  prettyRedeemedCredit: "19 Points",
  prettyRedeemedNumber: "19",
  dateRedeemed: 1640038417468,
};
export const RewardsCellCreditRedeemed = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...empty }, availableText: "{availableAmount} remaining" }));
};
const singleRedeemed = {
  prettyValue: "1 Point",
  prettyValueNumber: "1",
};
const longName = {
  prettyValue: "19 Points with a really really super duper longest name ever in the world wide web",
  prettyValueNumber: "19",
};
export const RewardsCellCreditLong = () => {
  return (h("div", { style: { maxWidth: "222px" } },
    h("sqm-rewards-table-reward-cell", { reward: { ...rewardsData, ...longName }, availableText: "{availableAmount} remaining" })));
};
export const RewardsCellNonCredit = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: {
      ...rewardsData,
      type: "GIFTCARD",
      prettyValue: "SaaSquatch Giftcard",
    } }));
};
export const RewardsCellFueltank = () => {
  return (h("sqm-rewards-table-reward-cell", { reward: {
      ...rewardsData,
      type: "FUELTANK",
      prettyValue: "Fueltank Reward",
      fuelTankCode: "AFUELTANKCODE",
    }, copyText: "Copied" }));
};
export const RewardsCellFueltankLong = () => {
  return (h("div", { style: { maxWidth: "222px" } },
    h("sqm-rewards-table-reward-cell", { reward: {
        ...rewardsData,
        type: "FUELTANK",
        prettyValue: "Long Fueltank Reward",
        fuelTankCode: "AFUELTANKCODE123456789123456789123456789123456789",
      }, copyText: "Copied" })));
};
export const SourceCellManual = () => {
  return (h("sqm-rewards-table-source-cell", { reward: rewardsData, rewardSourceText: "Manual" }));
};
export const SourceCellProgram = () => {
  return (h("sqm-rewards-table-source-cell", { reward: {
      ...rewardsData,
      rewardSource: "AUTOMATED",
      program: { name: "Klip Loyalty" },
    }, rewardSourceText: "{rewardSource, select, MANUAL {Manual} AUTOMATED {{programName}} other {}}" }));
};
const exchange = {
  exchangedRewardRedemptionTransaction: {
    id: "61c100117a82a376d88041196",
    creditRedeemed: 1,
    prettyRedeemedCredit: "1 Money",
    unit: "TESTUNIT",
    dateRedeemed: 1640038417173,
    redeemedRewards: null,
    exchangedRewards: null,
  },
};
export const SourceCellExchange = () => {
  return (h("sqm-rewards-table-source-cell", { reward: { ...rewardsData, ...exchange }, rewardExchangeText: "Reward Exchange" }));
};
const longUserName = {
  firstName: "Bartholomew",
  lastName: "Christopher-Johnston Wallace",
  imageUrl: null,
};
const johnDoe = {
  firstName: "John",
  lastName: "Doe",
  imageUrl: null,
};
const anon = {
  firstName: "",
  lastName: "",
  imageUrl: null,
};
const referral = (user = null) => {
  return {
    rewardSource: "FRIEND_SIGNUP",
    referral: {
      id: "123",
      dateConverted: 1640038417173,
      dateReferralStarted: 1640038417173,
      dateReferralPaid: 1640038417173,
      dateModerated: 1640038417173,
      dateReferralEnded: null,
      moderationStatus: null,
      rewards: null,
      referrerUser: user,
      referredUser: user,
    },
  };
};
const referred = (user = null) => {
  return {
    rewardSource: "REFERRED",
    referral: {
      id: "123",
      dateConverted: 1640038417173,
      dateReferralStarted: 1640038417173,
      dateReferralPaid: 1640038417173,
      dateModerated: 1640038417173,
      dateReferralEnded: null,
      moderationStatus: null,
      rewards: null,
      referrerUser: user,
      referredUser: user,
    },
  };
};
const deletedReferral = () => {
  return {
    rewardSource: "REFERRED",
    referral: null,
  };
};
export const SourceCellReferral = () => {
  return (h("sqm-rewards-table-source-cell", { reward: { ...rewardsData, ...referral(johnDoe) }, referralText: "Referral to" }));
};
export const SourceCellWithLongText = () => {
  return (h("div", { style: { width: "200px" } },
    h("sqm-rewards-table-source-cell", { reward: { ...rewardsData, ...referral(longUserName) }, referralText: "Referral to" })));
};
export const SourceCellReferred = () => {
  return (h("sqm-rewards-table-source-cell", { reward: { ...rewardsData, ...referred(johnDoe) }, referralText: "Referred by" }));
};
export const SourceCellAnonymousUser = () => {
  return (h("sqm-rewards-table-source-cell", { reward: { ...rewardsData, ...referral(anon) }, referralText: "Referral to", anonymousUserText: "Your Friend" }));
};
export const SourceCellDeletedUser = () => {
  return (h("sqm-rewards-table-source-cell", { reward: { ...rewardsData, ...referral(null) }, referralText: "Referral to", deletedUserText: "Deleted User" }));
};
export const SourceCellDeletedReferral = () => {
  return (h("sqm-rewards-table-source-cell", { 
    //@ts-ignore
    reward: { ...rewardsData, ...deletedReferral(null) }, referralText: "Referral to", deletedReferralText: "Deleted Referral" }));
};
export const StatusCellAvailable = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Available", reward: rewardsData }));
};
const expire = {
  dateExpires: 1640038417468,
};
export const StatusCellAvailableExpiry = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Available", reward: { ...rewardsData, ...expire }, expiryText: "Expires" }));
};
const redeemed = {
  statuses: ["REDEEMED"],
  dateRedeemed: 1640038417468,
};
export const StatusCellRedeemed = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Redeemed", reward: { ...rewardsData, ...redeemed } }));
};
const cancelled = {
  statuses: ["CANCELLED"],
  dateCancelled: 1640038417468,
};
export const StatusCellCancelled = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Cancelled", reward: { ...rewardsData, ...cancelled } }));
};
const expired = {
  statuses: ["EXPIRED"],
  dateExpires: 1640038417468,
};
export const StatusCellExpired = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Expired", reward: { ...rewardsData, ...expired } }));
};
const pending = {
  statuses: ["PENDING"],
};
const us_tax = {
  pendingReasons: ["US_TAX"],
};
const scheduled = {
  pendingReasons: ["SCHEDULED"],
  dateScheduledFor: 1640038417468,
};
const unhandled = {
  pendingReasons: ["UNHANDLED_ERROR"],
};
export const StatusCellPending = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: { ...rewardsData, ...pending } }));
};
export const StatusCellPendingWithLongText = () => {
  return (h("div", { style: { width: "200px" } },
    h("sqm-rewards-table-status-cell", { statusText: "Pending for 300,000,000 months and some change", reward: { ...rewardsData, ...pending } })));
};
export const StatusCellPendingUsTax = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: { ...rewardsData, ...pending, ...us_tax } }));
};
export const StatusCellPendingScheduled = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: { ...rewardsData, ...pending, ...scheduled } }));
};
export const StatusCellPendingUnhandled = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: { ...rewardsData, ...pending, ...unhandled } }));
};
export const StatusCellPendingReview = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: {
      ...rewardsData,
      referral: {
        id: "123",
        dateConverted: 1640038417173,
        dateReferralStarted: 1640038417173,
        dateReferralPaid: 1640038417173,
        dateModerated: 1640038417173,
        dateReferralEnded: null,
        moderationStatus: null,
        rewards: null,
        referrerUser: null,
        referredUser: null,
        fraudData: {
          moderationStatus: "PENDING",
          autoModerationStatus: "PENDING",
          manualModerationStatus: "PENDING",
        },
      },
    } }));
};
export const StatusCellDenied = () => {
  return (h("sqm-rewards-table-status-cell", { statusText: "Denied", reward: {
      ...rewardsData,
      dateCancelled: 10000,
      referral: {
        id: "123",
        dateConverted: 1640038417173,
        dateReferralStarted: 1640038417173,
        dateReferralPaid: 1640038417173,
        dateModerated: 1640038417173,
        dateReferralEnded: null,
        moderationStatus: null,
        rewards: null,
        referrerUser: null,
        referredUser: null,
        fraudData: {
          moderationStatus: "DENIED",
          autoModerationStatus: "DENIED",
          manualModerationStatus: "DENIED",
        },
      },
    } }));
};
export const DateCell = () => {
  return (h("sqm-rewards-table-date-cell", { date: 1640038417468 }));
};
export const CustomerNoteCell = () => {
  return (h("sqm-rewards-table-customer-note-cell", { note: rewardsData.meta.message }));
};
export const EmptyCell = () => {
  return h("sqm-rewards-table-date-cell", null);
};
