import { getActivateMembershipRouteParams } from '@dvn/core/util/route';
import { Component, h, Prop } from '@stencil/core';
export class DvnAppAnonymous {
  constructor() {
    this.isLandingPage = () => this.path === '/';
    this.isLoginPage = () => this.path === '/login';
    this.getRouteParams = () => getActivateMembershipRouteParams(this.path);
  }
  render() {
    if (this.isLandingPage() || this.isLoginPage()) {
      return (h("dvn-theme-provider", { colorBackground: true, fitHeight: true },
        h("dvn-global-grid", null),
        h("dvn-app-login-page", null)));
    }
    const { spaceId, membershipConfigId, membershipId } = this.getRouteParams();
    if (!!spaceId && !!membershipConfigId && !!membershipId) {
      // if all parameters are here, load activation page
      return (h("dvn-theme-provider", { colorBackground: true, fitHeight: true },
        h("dvn-global-grid", null),
        h("dvn-app-activate-membership-anonymous", { navigate: this.navigate, path: this.path })));
    }
    return (h("dvn-theme-provider", { colorBackground: true, fitHeight: true },
      h("dvn-global-grid", null),
      h("dvn-not-found", null)));
    // return (
    //   <Host>
    //     <dvn-theme-provider colorBackground={true} fitHeight={true}>
    //       <global-table />
    //       <global-grid />
    //       <global-text />
    //
    //       <dvn-app-context-injector>
    //         <stencil-router>
    //           <stencil-route-switch scrollTopOffset={0}>
    //             <stencil-route
    //               url='/login'
    //               component='dvn-app-login-page'
    //               exact={true}
    //             />
    //             <stencil-route
    //               url='/:membershipId/activate'
    //               component='dvn-app-activate-membership'
    //               exact={true}
    //             />
    //             <stencil-route
    //               url='/'
    //               component='dvn-app-landing-page'
    //             />
    //             <stencil-route
    //               component="dvn-not-found"
    //             />
    //           </stencil-route-switch>
    //         </stencil-router>
    //       </dvn-app-context-injector>
    //     </dvn-theme-provider>
    //   </Host>
    // );
  }
  static get is() { return "dvn-app-anonymous"; }
  static get properties() { return {
    "navigate": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "NavigationHandler",
        "resolved": "(config: NavigateConfig) => void",
        "references": {
          "NavigationHandler": {
            "location": "import",
            "path": "@dvn/core/routing/routing"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "path": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "path",
      "reflect": false
    }
  }; }
}
