'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-bae2a754.js');

const sparkleQuizContainerCss = ":host{display:block}";

const SparkleQuizContainer = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.showInstantResult = false;
    this.submitted = false;
    this.answers = {};
  }
  //TODO: not working
  pageDidLoadHandler($event) {
    if ($event) {
      this.pageInfo = $event.detail.pageInfo;
      console.log("pageInfo", this.pageInfo);
    }
  }
  updateQuizAnswerModelHandler(obj) {
    if (obj.detail.question) {
      this.answers[obj.detail.question.questionId] = {
        question: obj.detail.question,
        answer: obj.detail.answer
      };
    }
    console.log(this.answers);
  }
  submitQuiz() {
    this.submitted = true;
    let model = {
      pageInfo: this.pageInfo,
      quiz: this.answers
    };
    console.log(model);
    //post api
  }
  render() {
    return (index.h(index.Host, null, this.questionIds && this.questionIds.split(",").map((id => index.h("sparkle-quiz", { questionId: +id, submitted: this.submitted, showInstantResult: this.showInstantResult }))), index.h("ion-button", { slot: "end", onClick: () => this.submitQuiz() }, "Submit")));
  }
};
SparkleQuizContainer.style = sparkleQuizContainerCss;

exports.sparkle_quiz_container = SparkleQuizContainer;
