import { FireEnjin } from "@fireenjin/sdk";
import { h, Build, } from "@stencil/core";
import { getSdk } from "../../sdk";
export class Init {
  constructor() {
    this.token = undefined;
    this.host = undefined;
    this.sdk = undefined;
    this.client = undefined;
  }
  /**
   * Get the SDK
   * @returns The instance of Flood Team SDK
   */
  async getSdk() {
    return this.sdk;
  }
  /**
   * Get the GraphQL Client
   * @returns The instance of GraphQL SDK
   */
  async getClient() {
    return this.client;
  }
  componentDidLoad() {
    const { sdk, client } = new FireEnjin({
      getSdk,
      debug: Build === null || Build === void 0 ? void 0 : Build.isDev,
      token: this.token,
      connections: [
        {
          name: "default",
          type: "graphql",
          url: this.host || "https://theflood.team/graphql",
        },
      ],
    });
    this.sdk = sdk;
    this.client = client;
    console.log(this.sdk, this.client);
  }
  render() {
    return h("slot", null);
  }
  static get is() { return "floodteam-init"; }
  static get properties() {
    return {
      "token": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "The token used to authorize with Flood Team API"
        },
        "attribute": "token",
        "reflect": false
      },
      "host": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "The address of the API host"
        },
        "attribute": "host",
        "reflect": false
      }
    };
  }
  static get states() {
    return {
      "sdk": {},
      "client": {}
    };
  }
  static get methods() {
    return {
      "getSdk": {
        "complexType": {
          "signature": "() => Promise<any>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<any>"
        },
        "docs": {
          "text": "Get the SDK",
          "tags": [{
              "name": "returns",
              "text": "The instance of Flood Team SDK"
            }]
        }
      },
      "getClient": {
        "complexType": {
          "signature": "() => Promise<any>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<any>"
        },
        "docs": {
          "text": "Get the GraphQL Client",
          "tags": [{
              "name": "returns",
              "text": "The instance of GraphQL SDK"
            }]
        }
      }
    };
  }
}
