import { withHooks } from "@saasquatch/stencil-hooks";
import { Component, h, Host, Method, Prop } from "@stencil/core";
import { useRequestRerender } from "../../../tables/re-render";
/**
 * @uiName Referral Table Rewards Column
 * @validParents ["sqm-referral-table"]
 * @exampleGroup Referrals
 * @example Referral Table Rewards Column - <sqm-referral-table-rewards-column column-title="Rewards" status-text="{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} PROCESSING {Payment Processing} PAYOUT_FAILED {Payout Failed} PAYOUT_CANCELLED {Payout Cancelled} PENDING_TAX_REVIEW {Pending} PENDING_NEW_TAX_FORM {Pending} PENDING_TAX_SUBMISSION {Pending} PENDING_PARTNER_CREATION {Pending} DENIED {Denied} EXPIRED {Expired} REDEEMED {Redeemed} other {Not available} }" status-long-text="{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PAYOUT_FAILED {Payout failed due to a fulfillment issue and is currently being retried.} PAYOUT_CANCELLED {If you think this is a mistake, contact our Support team.} PENDING_TAX_REVIEW {Awaiting tax form review} PENDING_NEW_TAX_FORM {Invalid tax form. Submit a new form to receive your rewards.} PROCESSING {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PENDING_TAX_SUBMISSION {Submit your tax documents to receive your rewards} PENDING_PARTNER_CREATION {Complete your tax and cash payout setup to receive your rewards} DENIED {Denied on} EXPIRED {Reward expired on} other {Not available} }" fuel-tank-text="Your code is" reward-received-text="Reward received on" expiring-text="Expiring in" pending-for-text="{status} for {date}" denied-help-text="Contact support if you think this is a mistake." ></sqm-referral-table-rewards-column>
 */
export class ReferralTableRewardsColumn {
  constructor() {
    /**
     * @uiName Reward column title
     */
    this.columnTitle = "Rewards";
    /**
     * Text shown in the reward status badge.
     *
     * @uiName Reward status text
     * @uiWidget textArea
     */
    this.statusText = "{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} PROCESSING {Payment Processing} PAYOUT_FAILED {Payout Failed} PAYOUT_CANCELLED {Payout Cancelled} PENDING_TAX_REVIEW {Pending} PENDING_NEW_TAX_FORM {Pending} PENDING_TAX_SUBMISSION {Pending} PENDING_PARTNER_CREATION {Pending} DENIED {Denied} EXPIRED {Expired} REDEEMED {Redeemed} other {Not available} }";
    /**
     * Additional status text shown in the details drop down.
     *
     * @uiName Reward status long text
     * @uiWidget textArea
     */
    this.statusLongText = "{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PAYOUT_FAILED {Payout failed due to a fulfillment issue and is currently being retried.} PAYOUT_CANCELLED {If you think this is a mistake, contact our Support team.} PENDING_TAX_REVIEW {Awaiting tax form review} PENDING_NEW_TAX_FORM {Invalid tax form. Submit a new form to receive your rewards.} PROCESSING {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PENDING_TAX_SUBMISSION {Submit your tax documents to receive your rewards} PENDING_PARTNER_CREATION {Complete your tax and cash payout setup to receive your rewards} DENIED {Denied on} EXPIRED {Reward expired on} other {Not available} }";
    /**
     * Shown in the dropdown details when a reward has an associated fuel tank code.
     *
     * @uiName Fuel tank code text
     */
    this.fuelTankText = "Your code is";
    /**
     * Shown in the dropdown details when a reward has been received.’
     *
     * @uiName Reward received text
     */
    this.rewardReceivedText = "Reward received on";
    /**
     * Shown in the dropdown details when a reward has an expiry date.
     *
     * @uiName Reward expiring text
     */
    this.expiringText = "Expiring in";
    /**
     * Shown in the dropdown details when a reward is pending.
     *
     * @uiName Reward pending text
     */
    this.pendingForText = "{status} for {date}";
    /**
     * Shown in the dropdown details when a reward was denied.
     *
     * @uiName Reward denied help text
     */
    this.deniedHelpText = "Contact support if you think this is a mistake.";
    /**
     * @uiName Hide dropdown details of reward
     * @default
     */
    this.hideDetails = false;
    withHooks(this);
  }
  disconnectedCallback() { }
  async renderCell(data, options) {
    return (h("sqm-referral-table-rewards-cell", { rewards: data.rewards, taxConnection: options === null || options === void 0 ? void 0 : options.taxConnection, statusText: this.statusText, statusLongText: this.statusLongText, fuelTankText: this.fuelTankText, rewardReceivedText: this.rewardReceivedText, expiringText: this.expiringText, pendingForText: this.pendingForText, hideDetails: this.hideDetails, deniedHelpText: this.deniedHelpText, locale: options === null || options === void 0 ? void 0 : options.locale, exportparts: "sqm-cell-value" }));
  }
  async renderLabel() {
    return this.columnTitle;
  }
  async renderReferrerCell(data) {
    // TODO: Do the right thing with many rewards, pending rewards, canceled rewards
    return (h("sqm-referral-table-rewards-cell", { rewards: data.rewards, exportparts: "sqm-cell-value" }));
  }
  render() {
    useRequestRerender([
      this.columnTitle,
      this.statusText,
      this.statusLongText,
      this.fuelTankText,
      this.rewardReceivedText,
      this.expiringText,
      this.pendingForText,
      this.hideDetails,
    ]);
    return h(Host, { style: { display: "none" } });
  }
  static get is() { return "sqm-referral-table-rewards-column"; }
  static get encapsulation() { return "shadow"; }
  static get properties() { return {
    "columnTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward column title",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "column-title",
      "reflect": false,
      "defaultValue": "\"Rewards\""
    },
    "statusText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward status text",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Text shown in the reward status badge."
      },
      "attribute": "status-text",
      "reflect": false,
      "defaultValue": "\"{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} PROCESSING {Payment Processing} PAYOUT_FAILED {Payout Failed} PAYOUT_CANCELLED {Payout Cancelled} PENDING_TAX_REVIEW {Pending} PENDING_NEW_TAX_FORM {Pending} PENDING_TAX_SUBMISSION {Pending} PENDING_PARTNER_CREATION {Pending} DENIED {Denied} EXPIRED {Expired} REDEEMED {Redeemed} other {Not available} }\""
    },
    "statusLongText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward status long text",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Additional status text shown in the details drop down."
      },
      "attribute": "status-long-text",
      "reflect": false,
      "defaultValue": "\"{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PAYOUT_FAILED {Payout failed due to a fulfillment issue and is currently being retried.} PAYOUT_CANCELLED {If you think this is a mistake, contact our Support team.} PENDING_TAX_REVIEW {Awaiting tax form review} PENDING_NEW_TAX_FORM {Invalid tax form. Submit a new form to receive your rewards.} PROCESSING {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PENDING_TAX_SUBMISSION {Submit your tax documents to receive your rewards} PENDING_PARTNER_CREATION {Complete your tax and cash payout setup to receive your rewards} DENIED {Denied on} EXPIRED {Reward expired on} other {Not available} }\""
    },
    "fuelTankText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Fuel tank code text",
            "name": "uiName"
          }],
        "text": "Shown in the dropdown details when a reward has an associated fuel tank code."
      },
      "attribute": "fuel-tank-text",
      "reflect": false,
      "defaultValue": "\"Your code is\""
    },
    "rewardReceivedText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward received text",
            "name": "uiName"
          }],
        "text": "Shown in the dropdown details when a reward has been received.\u2019"
      },
      "attribute": "reward-received-text",
      "reflect": false,
      "defaultValue": "\"Reward received on\""
    },
    "expiringText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward expiring text",
            "name": "uiName"
          }],
        "text": "Shown in the dropdown details when a reward has an expiry date."
      },
      "attribute": "expiring-text",
      "reflect": false,
      "defaultValue": "\"Expiring in\""
    },
    "pendingForText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward pending text",
            "name": "uiName"
          }],
        "text": "Shown in the dropdown details when a reward is pending."
      },
      "attribute": "pending-for-text",
      "reflect": false,
      "defaultValue": "\"{status} for {date}\""
    },
    "deniedHelpText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward denied help text",
            "name": "uiName"
          }],
        "text": "Shown in the dropdown details when a reward was denied."
      },
      "attribute": "denied-help-text",
      "reflect": false,
      "defaultValue": "\"Contact support if you think this is a mistake.\""
    },
    "hideDetails": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Hide dropdown details of reward",
            "name": "uiName"
          }, {
            "text": undefined,
            "name": "default"
          }],
        "text": ""
      },
      "attribute": "hide-details",
      "reflect": false,
      "defaultValue": "false"
    }
  }; }
  static get methods() { return {
    "renderCell": {
      "complexType": {
        "signature": "(data: Referral, options?: { locale: string; taxConnection: ImpactConnection; }) => Promise<any>",
        "parameters": [{
            "tags": [],
            "text": ""
          }, {
            "tags": [],
            "text": ""
          }],
        "references": {
          "Promise": {
            "location": "global"
          },
          "Referral": {
            "location": "import",
            "path": "../../../saasquatch"
          },
          "ImpactConnection": {
            "location": "import",
            "path": "../../../saasquatch"
          }
        },
        "return": "Promise<any>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    },
    "renderLabel": {
      "complexType": {
        "signature": "() => Promise<string>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<string>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    },
    "renderReferrerCell": {
      "complexType": {
        "signature": "(data: Referrer) => Promise<any>",
        "parameters": [{
            "tags": [],
            "text": ""
          }],
        "references": {
          "Promise": {
            "location": "global"
          },
          "Referrer": {
            "location": "import",
            "path": "../../../saasquatch"
          }
        },
        "return": "Promise<any>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    }
  }; }
}
