import { withHooks } from "@saasquatch/stencil-hooks";
import { Component, h, Host, Method, Prop } from "@stencil/core";
import { useRequestRerender } from "../../../tables/re-render";
/**
 * @uiName Rewards Table Source Column
 * @validParents ["sqm-rewards-table"]
 * @exampleGroup Rewards
 * @example Reward Table Source Column - <sqm-rewards-table-source-column column-title="Source" anonymous-user="Your Friend" deleted-user="Deleted User" reward-exchange-text="Reward Exchange" referral-text="{rewardSource, select, FRIEND_SIGNUP {Referral to} REFERRED {Referred by} other {}}" reward-source-text="{rewardSource, select, MANUAL {Manual} AUTOMATED {{programName}} other {}}"></sqm-rewards-table-source-column>
 */
export class RewardTableUserColumn {
  constructor() {
    /**
     * @uiName Soruce column title
     */
    this.columnTitle = "Source";
    /**
     * Name displayed for unknown users
     *
     * @uiName Anonymous user text
     */
    this.anonymousUser = "Your Friend";
    /**
     * Name displayed for deleted users
     *
     * @uiName Deleted user text
     */
    this.deletedUser = "Deleted User";
    /**
     * @uiName Reward exchange label
     */
    this.rewardExchangeText = "Reward Exchange";
    /**
     * Shown when a reward has been created by a referral
     *
     * @uiName Referral text
     * @uiWidget textArea
     */
    this.referralText = "{rewardSource, select, FRIEND_SIGNUP {Referral to} REFERRED {Referred by} other {}}";
    /**
     * Shown when a reward has been created by a source other than a referral.
     *
     * @uiName Reward source text
     * @uiWidget textArea
     */
    this.rewardSourceText = "{rewardSource, select, MANUAL {Manual} AUTOMATED {{programName}} other {}}";
    withHooks(this);
  }
  disconnectedCallback() { }
  async renderCell(data, options) {
    return (h("sqm-rewards-table-source-cell", { reward: data, anonymousUserText: this.anonymousUser, deletedUserText: this.deletedUser, rewardExchangeText: this.rewardExchangeText, referralText: this.referralText, rewardSourceText: this.rewardSourceText, locale: options === null || options === void 0 ? void 0 : options.locale }));
  }
  async renderLabel() {
    return this.columnTitle;
  }
  render() {
    useRequestRerender([
      this.deletedUser,
      this.anonymousUser,
      this.columnTitle,
      this.rewardExchangeText,
      this.referralText,
      this.rewardSourceText,
    ]);
    return h(Host, { style: { display: "none" } });
  }
  static get is() { return "sqm-rewards-table-source-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": "Soruce column title",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "column-title",
      "reflect": false,
      "defaultValue": "\"Source\""
    },
    "anonymousUser": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Anonymous user text",
            "name": "uiName"
          }],
        "text": "Name displayed for unknown users"
      },
      "attribute": "anonymous-user",
      "reflect": false,
      "defaultValue": "\"Your Friend\""
    },
    "deletedUser": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Deleted user text",
            "name": "uiName"
          }],
        "text": "Name displayed for deleted users"
      },
      "attribute": "deleted-user",
      "reflect": false,
      "defaultValue": "\"Deleted User\""
    },
    "rewardExchangeText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward exchange label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "reward-exchange-text",
      "reflect": false,
      "defaultValue": "\"Reward Exchange\""
    },
    "referralText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Referral text",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Shown when a reward has been created by a referral"
      },
      "attribute": "referral-text",
      "reflect": false,
      "defaultValue": "\"{rewardSource, select, FRIEND_SIGNUP {Referral to} REFERRED {Referred by} other {}}\""
    },
    "rewardSourceText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Reward source text",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Shown when a reward has been created by a source other than a referral."
      },
      "attribute": "reward-source-text",
      "reflect": false,
      "defaultValue": "\"{rewardSource, select, MANUAL {Manual} AUTOMATED {{programName}} other {}}\""
    }
  }; }
  static get methods() { return {
    "renderCell": {
      "complexType": {
        "signature": "(data: Reward, options?: { locale: string; }) => Promise<any>",
        "parameters": [{
            "tags": [],
            "text": ""
          }, {
            "tags": [],
            "text": ""
          }],
        "references": {
          "Promise": {
            "location": "global"
          },
          "Reward": {
            "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": []
      }
    }
  }; }
}
