import React from "react";
import ExerciseWalkthrough from "@/training/ExerciseWalkthrough";
import { ITrainingTip, WalkthroughConfigs } from "./TrainingInterfaces";
import formatTip from "./FormatTip";


// This wrapper is just to test new exercises from the handbook, will be removed when all the tips and exercises are in firestore
const TrainingExercise: React.FC<ITrainingTip> = (trainingTip: ITrainingTip) => {
    const tip = {
        "category": "",
        "embedding": "",
        "text": "",
        "html": "",
        "id": "",
        "verified": true,
        "standalone": false,
        "exercise": {
            "question": "",
            "additional": "",
            "segments": []
        }
    }

    const mockTip: ITrainingTip = {
        id: "some random id",
        tipCategory: tip.category,
        tipHtml: tip.html,
        standalone: tip.standalone,
        exercise: {
            question: tip.exercise.question,
            additional: tip.exercise.additional,
            segments: tip.exercise.segments as WalkthroughConfigs[]
        }
    }

    const formattedTip = formatTip(mockTip);
    return (
        <ExerciseWalkthrough {...formatTip(trainingTip)}
        />
    );
}

export default TrainingExercise;