import { r as registerInstance, h, H as Host } from './index-5568e3fa.js';

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

const SparkleQuizContainer = class {
  constructor(hostRef) {
    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 (h(Host, null, this.questionIds && this.questionIds.split(",").map((id => h("sparkle-quiz", { questionId: +id, submitted: this.submitted, showInstantResult: this.showInstantResult }))), h("ion-button", { slot: "end", onClick: () => this.submitQuiz() }, "Submit")));
  }
};
SparkleQuizContainer.style = sparkleQuizContainerCss;

export { SparkleQuizContainer as sparkle_quiz_container };
