import {
    FaListUl,
    FaUnderline,
    FaPen,
    FaBookOpen,
    FaEnvelope,
    FaComments,
    FaHandshake,
    FaParagraph,
    FaLightbulb,
    FaHeadphones,
    FaWpforms,
} from 'react-icons/fa6';

import {
    FaEdit,
    FaFileAlt,
    FaUserFriends,
    FaCheckSquare,
    FaQuestionCircle,
} from 'react-icons/fa';
import { ExerciseGen } from './generatedExercises';
import { BsListCheck } from 'react-icons/bs';

const quantity = (quantity: number, tooltip?: string) => {
    return {
        param: "quantity",
        label: "Quantity",
        tooltip: tooltip ? tooltip : "Exercise Quantity",
        value: quantity
    }
}

const difficulty = () => {
    return {
        param: "difficulty",
        label: "Difficulty",
        tooltip: "Exercise difficulty",
    }
}

const generate = () => {
    return {
        param: "generate",
        value: true
    }
}

const reading = (passage: number) => {
    const readingExercises = [
        {
            label: `Passage ${passage} - Multiple Choice`,
            type: `reading_${passage}`,
            icon: BsListCheck,
            sectionId: passage,
            extra: [
                {
                    param: "name",
                    value: "multipleChoice"
                },
                quantity(5, "Quantity of Multiple Choice Questions"),
                difficulty(),
                generate()
            ],
            module: "reading"
        },
        {
            label: `Passage ${passage} - Fill Blanks`,
            type: `reading_${passage}`,
            icon: FaEdit,
            sectionId: passage,
            extra: [
                {
                    param: "name",
                    value: "fillBlanks"
                },
                {
                    param: "num_random_words",
                    label: "Random Words",
                    tooltip: "Words that are not the solution",
                    value: 1
                },
                quantity(4, "Quantity of Blanks"),
                difficulty(),
                generate()
            ],
            module: "reading"
        },
        {
            label: `Passage ${passage} - Write Blanks`,
            type: `reading_${passage}`,
            icon: FaPen,
            sectionId: passage,
            extra: [
                {
                    param: "name",
                    value: "writeBlanks"
                },
                {
                    param: "max_words",
                    label: "Word Limit",
                    tooltip: "How many words a solution can have",
                    value: 3
                },
                quantity(4, "Quantity of Blanks"),
                difficulty(),
                generate()
            ],
            module: "reading"
        },
        {
            label: `Passage ${passage} - True False`,
            type: `reading_${passage}`,
            icon: FaCheckSquare,
            sectionId: passage,
            extra: [
                {
                    param: "name",
                    value: "trueFalse"
                },
                quantity(4, "Quantity of Statements"),
                difficulty(),
                generate()
            ],
            module: "reading"
        },
        {
            label: `Passage ${passage} - Paragraph Match`,
            type: `reading_${passage}`,
            icon: FaParagraph,
            sectionId: passage,
            extra: [
                {
                    param: "name",
                    value: "paragraphMatch"
                },
                quantity(5, "Quantity of Matches"),
                difficulty(),
                generate()
            ],
            module: "reading"
        },
    ];

    if (passage === 3) {
        readingExercises.push(
            {
                label: `Passage 3 - Idea Match`,
                type: `reading_3`,
                icon: FaLightbulb,
                sectionId: passage,
                extra: [
                    {
                        param: "name",
                        value: "ideaMatch"
                    },
                    quantity(5, "Quantity of Ideas"),
                    difficulty(),
                    generate()
                ],
                module: "reading"
            },
        );
    }
    return readingExercises;
}

const listening = (section: number) => {
    const listeningExercises = [
        {
            label: `Section ${section} - Multiple Choice`,
            type: `listening_${section}`,
            icon: FaHeadphones,
            sectionId: section,
            extra: [
                {
                    param: "name",
                    value: section == 3 ? "multipleChoice3Options" : "multipleChoice"
                },
                quantity(5, "Quantity of Multiple Choice Questions"),
                difficulty(),
                generate()
            ],
            module: "listening"
        },
        {
            label: `Section ${section} - Write Blanks: Questions`,
            type: `listening_${section}`,
            icon: FaQuestionCircle,
            sectionId: section,
            extra: [
                {
                    param: "name",
                    value: "writeBlanksQuestions"
                },
                quantity(5, "Quantity of Blanks"),
                difficulty(),
                generate()
            ],
            module: "listening"
        },
        {
            label: `Section ${section} - True False`,
            type: `listening_${section}`,
            icon: FaCheckSquare,
            sectionId: section,
            extra: [
                {
                    param: "name",
                    value: "trueFalse"
                },
                quantity(4, "Quantity of Statements"),
                difficulty(),
                generate()
            ],
            module: "listening"
        },
    ];

    if (section === 1 || section === 4) {
        listeningExercises.push(
            {
                label: `Section ${section} - Write Blanks: Fill`,
                type: `listening_${section}`,
                icon: FaEdit,
                sectionId: section,
                extra: [
                    {
                        param: "name",
                        value: "writeBlanksFill"
                    },
                    quantity(5, "Quantity of Blanks"),
                    difficulty(),
                    generate()
                ],
                module: "listening"
            }
        );
        listeningExercises.push(
            {
                label: `Section ${section} - Write Blanks: Form`,
                type: `listening_${section}`,
                sectionId: section,
                icon: FaWpforms,
                extra: [
                    {
                        param: "name",
                        value: "writeBlanksForm"
                    },
                    quantity(5, "Quantity of Blanks"),
                    difficulty(),
                    generate()
                ],
                module: "listening"
            }
        );
    }
    return listeningExercises;
}

const EXERCISES: ExerciseGen[] = [
    /*{
        label: "Multiple Choice",
        type: "multipleChoice",
        icon: FaListUl,
        extra: [
            {
                param: "name",
                value: "multipleChoice"
            },
            quantity(10, "Amount"),
            difficulty(),
            generate()
        ],
        module: "level"
    },*/
    {
        label: "Multiple Choice: Blank Space",
        type: "mcBlank",
        icon: FaEdit,
        extra: [
            {
                param: "name",
                value: "mcBlank"
            },
            quantity(10, "Amount"),
            difficulty(),
            generate()
        ],
        module: "level"
    },
    {
        label: "Multiple Choice: Underlined",
        type: "mcUnderline",
        icon: FaUnderline,
        extra: [
            {
                param: "name",
                value: "mcUnderline"
            },
            quantity(10, "Amount"),
            difficulty(),
            generate()
        ],
        module: "level"
    },
    /*{
        label: "Blank Space", <- Assuming this is FillBlanks aswell
        type: "blankSpaceText",
        icon: FaPen,
        extra: [
            quantity(10, "Nº of Blanks"),
            {
                label: "Passage Word Size",
                param: "text_size",
                value: "250"
            },
            difficulty(),
            generate()
        ],
        module: "level"
    },*/
    {
        label: "Fill Blanks: Multiple Choice",
        type: "fillBlanksMC",
        icon: FaPen,
        extra: [
            {
                param: "name",
                value: "fillBlanksMC"
            },
            quantity(10, "Nº of Blanks"),
            {
                label: "Passage Word Size",
                param: "text_size",
                value: "250"
            },
            difficulty(),
            generate()
        ],
        module: "level"
    },
    // Removing this since level supports reading aswell
    /*{
        label: "Reading Passage: Multiple Choice",
        type: "passageUtas",
        icon: FaBookOpen,
        extra: [
            {
                param: "name",
                value: "passageUtas"
            },
            // in the utas exam there was only mc so I'm assuming short answers are deprecated
            //{
            //    label: "Short Answers",
            //    param: "sa_qty",
            //    value: "10"
            //},
            quantity(10, "Multiple Choice Quantity"),
            {
                label: "Reading Passage Topic",
                param: "topic",
                value: "",
                type: "text"
            },
            {
                label: "Passage Word Size",
                param: "text_size",
                value: "700"
            },
            difficulty(),
            generate()
        ],
        module: "level"
    },*/
    {
        label: "Task 1 - Letter",
        type: "writing_letter",
        icon: FaEnvelope,
        extra: [
            {
                label: "Letter Topic",
                param: "topic",
                value: "",
                type: "text"
            },
            difficulty(),
            generate()
        ],
        module: "writing"
    },
    {
        label: "Task 2 - Essay",
        type: "writing_2",
        icon: FaFileAlt,
        extra: [
            {
                label: "Essay Topic",
                param: "topic",
                value: "",
                type: "text"
            },
            difficulty(),
            generate()
        ],
        module: "writing"
    },
    {
        label: "Exercise 1",
        type: "speaking_1",
        icon: FaComments,
        extra: [
            difficulty(),
            generate(),
            {
                label: "First Topic",
                param: "first_topic",
                value: "",
                type: "text"
            },
            {
                label: "Second Topic",
                param: "second_topic",
                value: "",
                type: "text"
            },
        ],
        module: "speaking"
    },
    {
        label: "Exercise 2",
        type: "speaking_2",
        icon: FaUserFriends,
        extra: [
            difficulty(),
            generate(),
            {
                label: "Topic",
                param: "topic",
                value: "",
                type: "text"
            },
        ],
        module: "speaking"
    },
    {
        label: "Interactive",
        type: "speaking_3",
        icon: FaHandshake,
        extra: [
            difficulty(),
            generate(),
            {
                label: "Topic",
                param: "topic",
                value: "",
                type: "text"
            },
        ],
        module: "speaking"
    },
    ...reading(1),
    ...reading(2),
    ...reading(3),
    ...listening(1),
    ...listening(2),
    ...listening(3),
    ...listening(4),
]

export default EXERCISES;
