#include "io.h"

std::vector<Button> &games::nost::get_buttons() {
    static std::vector<Button> buttons;

    if (buttons.empty()) {
        buttons = GameAPI::Buttons::getButtons("Nostalgia");

        GameAPI::Buttons::sortButtons(
                &buttons,
                "Service",
                "Test",
                "Coin Mech",
                "Key 1",
                "Key 2",
                "Key 3",
                "Key 4",
                "Key 5",
                "Key 6",
                "Key 7",
                "Key 8",
                "Key 9",
                "Key 10",
                "Key 11",
                "Key 12",
                "Key 13",
                "Key 14",
                "Key 15",
                "Key 16",
                "Key 17",
                "Key 18",
                "Key 19",
                "Key 20",
                "Key 21",
                "Key 22",
                "Key 23",
                "Key 24",
                "Key 25",
                "Key 26",
                "Key 27",
                "Key 28",
                "Key 1 Soft",
                "Key 2 Soft",
                "Key 3 Soft",
                "Key 4 Soft",
                "Key 5 Soft",
                "Key 6 Soft",
                "Key 7 Soft",
                "Key 8 Soft",
                "Key 9 Soft",
                "Key 10 Soft",
                "Key 11 Soft",
                "Key 12 Soft",
                "Key 13 Soft",
                "Key 14 Soft",
                "Key 15 Soft",
                "Key 16 Soft",
                "Key 17 Soft",
                "Key 18 Soft",
                "Key 19 Soft",
                "Key 20 Soft",
                "Key 21 Soft",
                "Key 22 Soft",
                "Key 23 Soft",
                "Key 24 Soft",
                "Key 25 Soft",
                "Key 26 Soft",
                "Key 27 Soft",
                "Key 28 Soft",
                "Key 1 Medium",
                "Key 2 Medium",
                "Key 3 Medium",
                "Key 4 Medium",
                "Key 5 Medium",
                "Key 6 Medium",
                "Key 7 Medium",
                "Key 8 Medium",
                "Key 9 Medium",
                "Key 10 Medium",
                "Key 11 Medium",
                "Key 12 Medium",
                "Key 13 Medium",
                "Key 14 Medium",
                "Key 15 Medium",
                "Key 16 Medium",
                "Key 17 Medium",
                "Key 18 Medium",
                "Key 19 Medium",
                "Key 20 Medium",
                "Key 21 Medium",
                "Key 22 Medium",
                "Key 23 Medium",
                "Key 24 Medium",
                "Key 25 Medium",
                "Key 26 Medium",
                "Key 27 Medium",
                "Key 28 Medium",
                "Key 1 Hard",
                "Key 2 Hard",
                "Key 3 Hard",
                "Key 4 Hard",
                "Key 5 Hard",
                "Key 6 Hard",
                "Key 7 Hard",
                "Key 8 Hard",
                "Key 9 Hard",
                "Key 10 Hard",
                "Key 11 Hard",
                "Key 12 Hard",
                "Key 13 Hard",
                "Key 14 Hard",
                "Key 15 Hard",
                "Key 16 Hard",
                "Key 17 Hard",
                "Key 18 Hard",
                "Key 19 Hard",
                "Key 20 Hard",
                "Key 21 Hard",
                "Key 22 Hard",
                "Key 23 Hard",
                "Key 24 Hard",
                "Key 25 Hard",
                "Key 26 Hard",
                "Key 27 Hard",
                "Key 28 Hard",
                "Swipe Next Page",
                "Swipe Previous Page",
                "Touch Confirm",
                "Touch Back",
                "Touch Song 1",
                "Touch Song 2",
                "Touch Song 3",
                "Touch Song 4",
                "Touch Song 5",
                "Touch Song 6",
                "Touch Difficulty 1",
                "Touch Difficulty 2",
                "Touch Difficulty 3",
                "Touch Difficulty 4"
        );
    }

    return buttons;
}

std::string games::nost::get_buttons_help() {
    // keep to max 100 characters wide
    return
        "For a MIDI piano, use [Key 1-28] for velocity-sensitive input.\n"
        "For digital input (PC keyboard), use [Key 1-28 Medium].\n"
        "For velocity-sensitive controllers in HID mode, use Analog tab.\n"
        "\n"
        "[Key 1-28] are velocity sensitive.\n"
        "[Key 1-28 Soft] always trigger minimum velocity (ELEGANT in blue zone).\n"
        "[Key 1-28 Medium] always trigger medium velocity (ELEGANT in both blue and yellow zones).\n"
        "[Key 1-28 Hard] always trigger maximum velocity (ELEGANT in yellow zone)."
        "\n"
        "Swipe/Touch bindings are used for touch emulation, but enable -nostpoke first."
        ;
}

std::vector<Analog> &games::nost::get_analogs() {
    static std::vector<Analog> analogs;

    if (analogs.empty()) {
        analogs = GameAPI::Analogs::getAnalogs("Nostalgia");

        GameAPI::Analogs::sortAnalogs(
                &analogs,
                "Key 1",
                "Key 2",
                "Key 3",
                "Key 4",
                "Key 5",
                "Key 6",
                "Key 7",
                "Key 8",
                "Key 9",
                "Key 10",
                "Key 11",
                "Key 12",
                "Key 13",
                "Key 14",
                "Key 15",
                "Key 16",
                "Key 17",
                "Key 18",
                "Key 19",
                "Key 20",
                "Key 21",
                "Key 22",
                "Key 23",
                "Key 24",
                "Key 25",
                "Key 26",
                "Key 27",
                "Key 28"
        );
    }
    return analogs;
}

std::vector<Light> &games::nost::get_lights() {
    static std::vector<Light> lights;

    if (lights.empty()) {
        lights = GameAPI::Lights::getLights("Nostalgia");

        GameAPI::Lights::sortLights(
                &lights,
                "Title R",
                "Title G",
                "Title B",
                "Bottom R",
                "Bottom G",
                "Bottom B",
                "Key 1 R",
                "Key 1 G",
                "Key 1 B",
                "Key 2 R",
                "Key 2 G",
                "Key 2 B",
                "Key 3 R",
                "Key 3 G",
                "Key 3 B",
                "Key 4 R",
                "Key 4 G",
                "Key 4 B",
                "Key 5 R",
                "Key 5 G",
                "Key 5 B",
                "Key 6 R",
                "Key 6 G",
                "Key 6 B",
                "Key 7 R",
                "Key 7 G",
                "Key 7 B",
                "Key 8 R",
                "Key 8 G",
                "Key 8 B",
                "Key 9 R",
                "Key 9 G",
                "Key 9 B",
                "Key 10 R",
                "Key 10 G",
                "Key 10 B",
                "Key 11 R",
                "Key 11 G",
                "Key 11 B",
                "Key 12 R",
                "Key 12 G",
                "Key 12 B",
                "Key 13 R",
                "Key 13 G",
                "Key 13 B",
                "Key 14 R",
                "Key 14 G",
                "Key 14 B",
                "Key 15 R",
                "Key 15 G",
                "Key 15 B",
                "Key 16 R",
                "Key 16 G",
                "Key 16 B",
                "Key 17 R",
                "Key 17 G",
                "Key 17 B",
                "Key 18 R",
                "Key 18 G",
                "Key 18 B",
                "Key 19 R",
                "Key 19 G",
                "Key 19 B",
                "Key 20 R",
                "Key 20 G",
                "Key 20 B",
                "Key 21 R",
                "Key 21 G",
                "Key 21 B",
                "Key 22 R",
                "Key 22 G",
                "Key 22 B",
                "Key 23 R",
                "Key 23 G",
                "Key 23 B",
                "Key 24 R",
                "Key 24 G",
                "Key 24 B",
                "Key 25 R",
                "Key 25 G",
                "Key 25 B",
                "Key 26 R",
                "Key 26 G",
                "Key 26 B",
                "Key 27 R",
                "Key 27 G",
                "Key 27 B",
                "Key 28 R",
                "Key 28 G",
                "Key 28 B"
        );
    }

    return lights;
}
