import { ActionFormData } from "@minecraft/server-ui";
import { guideBasicConcepts } from "./guideBasicConcepts";
import { guideBlockView } from "./guideBlockView";
import { guideItemView } from "./guideItemView";


export const guideMainView = (player) => {
    const actionForm = new ActionFormData();
    actionForm.title("view.title.guide")//Guía del Addon
    actionForm.body(
        {
            rawtext: [
                {
                    translate: "view.description.guide.1"
                },
                {
                    translate: "view.description.guide.2"
                },
                {
                    translate: "view.description.guide.3"
                },
                {
                    translate: "view.description.guide.4"
                }
            ]
        }
    )//Explora el contenido del addon:
    actionForm.button("view.title.guide.concepts", "textures/nps/ec/items/electrical_creativity_guide")//Conceptos
    actionForm.button("view.title.guide.block", "textures/nps/ec/blocks/furnace_energy_on")//Bloques
    actionForm.button("view.title.guide.item", "textures/nps/ec/items/plasma_scrap")//Items
    actionForm.button("view.button_exit");//Exit

    actionForm.show(player).then((data) => { 
        if (data.canceled) return;
        if (data.selection == 0) {
            guideBasicConcepts(player);
        } else if (data.selection == 1) {
            guideBlockView(player);
        } else if (data.selection == 2) {
            guideItemView(player);
        } else {
            return;
        }
    })
}