import { isDemo } from "@saasquatch/component-boilerplate";
import { withHooks } from "@saasquatch/stencil-hooks";
import { h, Component, Prop, State, Host } from "@stencil/core";
import { usePortalProtectedRoute } from "./usePortalProtectedRoute";
/**
 * @uiName Microsite Protected Route
 * @validParents ["sqm-portal-container","div","sqm-divided-layout","sqm-brand","template", "sqb-program-section", "sqb-conditional-section"]
 * @slots [{"name":"","title":"Route Content"}]
 */
export class PortalProtectedRoute {
  constructor() {
    this.ignored = true;
    /**
     * Redirect participants to this page they are not logged in.
     *
     * @uiName Unauthenticated participant redirect
     */
    this.redirectTo = "/";
    /**
     * @uiName Require email verification
     */
    this.requireEmailVerification = false;
    /**
     * Redirect participants to this page when email verification is required but they have not verified their email.
     *
     * @uiName Unverified participant redirect
     */
    this.redirectToUnverified = "/emailVerification";
    withHooks(this);
  }
  disconnectedCallback() { }
  render() {
    const hasUser = isDemo()
      ? usePortalProtectedRouteDemo(this)
      : usePortalProtectedRoute(this);
    return (h(Host, { style: { display: hasUser ? "contents" : "none" } },
      h("slot", null)));
  }
  static get is() { return "sqm-portal-protected-route"; }
  static get encapsulation() { return "shadow"; }
  static get properties() { return {
    "redirectTo": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Unauthenticated participant redirect",
            "name": "uiName"
          }],
        "text": "Redirect participants to this page they are not logged in."
      },
      "attribute": "redirect-to",
      "reflect": false,
      "defaultValue": "\"/\""
    },
    "requireEmailVerification": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Require email verification",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "require-email-verification",
      "reflect": false,
      "defaultValue": "false"
    },
    "redirectToUnverified": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Unverified participant redirect",
            "name": "uiName"
          }],
        "text": "Redirect participants to this page when email verification is required but they have not verified their email."
      },
      "attribute": "redirect-to-unverified",
      "reflect": false,
      "defaultValue": "\"/emailVerification\""
    }
  }; }
  static get states() { return {
    "ignored": {}
  }; }
}
function usePortalProtectedRouteDemo({}) {
  return true;
}
