import { ActionFormData } from "@minecraft/server-ui";
import { guideMainView } from "./guideMainView";
import { guideViewComponet } from "./components";

export const guideBasicConcepts = (player) => {
    const actionForm = new ActionFormData();
    actionForm.title("view.title.guide.concepts")//Conceptos
    actionForm.body("view.description.guide.concepts")//Categorías de conceptos
    actionForm.button("view.title.guide.concepts.energy", "textures/nps/ec/guide/energy")//Energia pura/no pura
    actionForm.button("view.title.guide.concepts.interfaces", "textures/nps/ec/guide/interfaces")//Interfaces
    actionForm.button("view.title.guide.concepts.connections", "textures/nps/ec/guide/connections")//Coneciones
    actionForm.button("view.button_return");//Regresar

    actionForm.show(player).then((data) => {
        if (data.canceled) return;
        if (data.selection == 0) {
            guideViewComponet(player, "view.title.guide.concepts.energy", {
                rawtext: [
                    { translate: "view.energy.1" },
                    { translate: "view.energy.2" },
                    { translate: "view.energy.3" },
                    { translate: "view.energy.4" },
                    { translate: "view.energy.5" },
                    { translate: "view.energy.6" },
                    { translate: "view.energy.7" }
                ]
            }, guideBasicConcepts);
        } else if (data.selection == 1) {
            guideViewComponet(player, "view.title.guide.concepts.interfaces", {
                rawtext: [
                    { translate: "view.interfaces.1" },
                    { translate: "view.interfaces.2" },
                    { translate: "view.interfaces.3" },
                    { translate: "view.interfaces.4" },
                    { translate: "view.interfaces.5" },
                    { translate: "view.interfaces.6" },
                    { translate: "view.interfaces.7" },
                    { translate: "view.interfaces.8" },
                    { translate: "view.interfaces.9" }
                ]
            }, guideBasicConcepts);
        } else if (data.selection == 2) {
            guideViewComponet(player, "view.title.guide.concepts.connections", {
                rawtext: [
                    { translate: "view.connections.1" },
                    { translate: "view.connections.2" },
                    { translate: "view.connections.3" },
                    { translate: "view.connections.4" },
                    { translate: "view.connections.5" },
                    { translate: "view.connections.6" },
                    { translate: "view.connections.7" },
                    { translate: "view.connections.8" },
                    { translate: "view.connections.9" },
                    { translate: "view.connections.10" },
                    { translate: "view.connections.11" }
                ]
            }, guideBasicConcepts);
        } else {
            guideMainView(player);
        }
    })
}