import {
  ReviewQuestion_default
} from "./chunk-372NAQFW.js";
import {
  complete_review_default
} from "./chunk-OWS5GSSD.js";
import {
  start_review_default
} from "./chunk-M46CNRFQ.js";
import {
  CurriculumReviewProvider,
  useCurriculumReviewContext
} from "./chunk-GMKRNFH5.js";

// src/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.tsx
import { jsx } from "react/jsx-runtime";
function CurriculumReviewStepsInner() {
  const {
    formik,
    step,
    handleStart,
    handleNext,
    handlePrev,
    onClickReviewMyAnswer,
    handleSubmit,
    currentQuestion,
    currentAnswer,
    currentError,
    reviewContents,
    handleAnswerChange
  } = useCurriculumReviewContext();
  const { questions } = reviewContents;
  if (step === 0) {
    return /* @__PURE__ */ jsx(start_review_default, { onStart: handleStart });
  }
  if (step > 0 && step <= questions.length && currentQuestion) {
    return /* @__PURE__ */ jsx(
      ReviewQuestion_default,
      {
        answer: currentAnswer,
        error: currentError,
        index: step - 1,
        isLast: step === questions.length,
        isLoading: formik.isSubmitting,
        isNextDisabled: currentError !== void 0,
        onChange: handleAnswerChange,
        onNext: handleNext,
        onPrev: handlePrev,
        onSubmit: handleSubmit,
        question: currentQuestion,
        total: questions.length
      }
    );
  }
  return /* @__PURE__ */ jsx(complete_review_default, { onClickReviewMyAnswer });
}
function CurriculumReviewSteps({
  contents,
  title,
  onClickEndReview,
  onSubmit,
  defaultValues,
  curriculum,
  onReviewValueChange,
  mode,
  done
}) {
  return /* @__PURE__ */ jsx(
    CurriculumReviewProvider,
    {
      curriculum,
      defaultValues,
      done,
      mode,
      onClickEndReview,
      onReviewValueChange,
      onSubmit,
      reviewContents: contents,
      sectionTitle: title,
      children: /* @__PURE__ */ jsx(CurriculumReviewStepsInner, {})
    }
  );
}
var CurriculumReviewSteps_default = CurriculumReviewSteps;

export {
  CurriculumReviewSteps_default
};
//# sourceMappingURL=chunk-HZ2U5JHC.js.map