import { Component, h, Host, Prop, State } from '@stencil/core';
import { SozlukApi } from '@dvn/sozluk/api';
import { Logger } from '@dvn/core/log/logger';
import { InstanceStorage } from '@dvn/kimlik/storage/instance';
import { AtamaApiDemo } from '../../../../khanguru-demo/src/mentorship-space/api/AtamaApiDemo';
import { DataApiDemo } from '../../../../khanguru-demo/src/mentorship-space/api/DataApiDemo';
import { KimlikApiDemo } from '../../../../khanguru-demo/src/mentorship-space/api/KimlikApiDemo';
import { TakvimApiDemo } from '../../../../khanguru-demo/src/mentorship-space/api/TakvimApiDemo';
import { UyeApiDemo } from '../../../../khanguru-demo/src/mentorship-space/api/UyeApiDemo';
export class KhanguruUiTestWrapper {
  constructor() {
    this.path = '/';
    this.navigate = (config) => {
      this.logger.infoGroup('navigate', {
        from: this.path,
        to: config.path,
      });
      this.path = config.path;
    };
  }
  componentWillLoad() {
    const { database, testKey } = this;
    this.logger = new Logger(testKey).setLevel('debug');
    this.logger.infoGroup('componentWillLoad', { storageKey: this.storageKey });
    this.storage = new InstanceStorage(this.storageKey, this.logger);
    Object.entries(this.storageData || {}).map(([key, value]) => {
      this.storage.save(key, value);
    });
    this.apiAtama = new AtamaApiDemo(database, this.logger);
    this.apiData = new DataApiDemo(database, this.logger);
    this.apiKimlik = new KimlikApiDemo(database, this.storage, this.logger);
    this.apiTakvim = new TakvimApiDemo(database, this.storage, this.logger);
    this.apiUye = new UyeApiDemo(database, this.storage, this.logger);
    this.apiSozluk = new SozlukApi();
    this.path = this.initialPath;
  }
  render() {
    return (h(Host, null,
      h("dvn-app-root", { apiAtama: this.apiAtama, apiData: this.apiData, apiKimlik: this.apiKimlik, apiSozluk: this.apiSozluk, apiTakvim: this.apiTakvim, apiUye: this.apiUye, navigate: this.navigate, path: this.path, logger: this.logger, storage: this.storage })));
  }
  static get is() { return "khanguru-ui-test-wrapper"; }
  static get originalStyleUrls() { return {
    "$": ["khanguru-ui-test-wrapper.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["khanguru-ui-test-wrapper.css"]
  }; }
  static get properties() { return {
    "testKey": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "The mock data to use in mock APIs."
      },
      "attribute": "test-key",
      "reflect": false
    },
    "database": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "object",
        "resolved": "object",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "storageData": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "object",
        "resolved": "object",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "storageKey": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "storage-key",
      "reflect": false
    },
    "initialPath": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "initial-path",
      "reflect": false
    }
  }; }
  static get states() { return {
    "path": {}
  }; }
}
