import { useNavigate } from "react-router-dom";
import { useUpdateStep } from "@/components/ChatsPath/hooks/useUpdateStep";
import routes from "@/routes";
import { IAnswer } from "@/components/ChatsPath/data";
import Answers from "@/components/ChatsPath/components/Answers";
import { missingInLifeAnswers } from "@/components/ChatsPath/data/missingInLifeAnswers";
import { useTranslations } from "@/hooks/translations";
import { ELocalesPlacement } from "@/locales";

function MissingInLife() {
  const { translate } = useTranslations(ELocalesPlacement.Chats);
  useUpdateStep(9);
  const navigate = useNavigate();

  const handleNext = () => {
    navigate(routes.client.chatsRecognize());
  };

  const answers: IAnswer[] = missingInLifeAnswers.map((answer) => {
    return {
      ...answer,
      name: translate(answer.name as string),
      onClick: handleNext,
    };
  });

  return (
    <>
      <h2 className={`chats-answers-title`}>
        {translate("/quiz/missingInLife.title")}
      </h2>
      <Answers answers={answers} />
    </>
  );
}

export default MissingInLife;
