import { SozlukApi } from '@dvn/sozluk/api';
import { Component, h, Host, Prop, State } from '@stencil/core';
import { createMentornityApiInstance } from 'src/modules/mentornity-js-client';
import { mentornityApiEndpoint } from '../../constants/env';
import { getSessionDetails } from '../../util/session';
import { sozlukEntries } from '../sozluk-entries';
export class MentornityAcceptInvitationWrapper {
  constructor() {
    this.getInvitation = async () => {
      this.invitation = await this.api.getInvitation(this.paramsId);
    };
  }
  componentWillLoad() {
    const { headers } = getSessionDetails();
    this.api = createMentornityApiInstance(mentornityApiEndpoint, headers);
    this.apiSozluk = new SozlukApi().setLanguage(this.language).setContents(sozlukEntries);
    this.getInvitation();
  }
  render() {
    if (!this.invitation)
      return;
    const { invitation, apiSozluk, isLoggedIn, api, language } = this;
    const { organisation } = invitation;
    return (h(Host, null,
      h("mentornity-root-wrapper", { class: "d-block" },
        h("div", { class: "pt-2", style: { background: 'var(--color-background-secondary)' } },
          h("mentornity-accept-invitation-widget", { organisation: organisation, invitation: invitation, apiSozluk: apiSozluk, api: api, isLoggedIn: isLoggedIn, language: language })))));
  }
  static get is() { return "mentornity-accept-invitation-wrapper"; }
  static get properties() { return {
    "paramsId": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "params-id",
      "reflect": false
    },
    "language": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "language",
      "reflect": false
    },
    "isLoggedIn": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "is-logged-in",
      "reflect": false
    }
  }; }
  static get states() { return {
    "api": {},
    "invitation": {}
  }; }
}
