import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;

class AntPlusTestAppMenuDelegate extends WatchUi.MenuInputDelegate {

    hidden var m_speedView;
    hidden var m_speedCadenceView;
    hidden var m_powerView;

    hidden var m_speedViewDelegate;
    hidden var m_speedCadenceViewDelegate;
    hidden var m_powerViewDelegate;

    hidden var m_antplus;

    function initialize() {
        MenuInputDelegate.initialize();

        m_antplus = new antplus();

        m_speedView = new AntPlusTestAppSpeedView(m_antplus);
        m_speedCadenceView = new AntPlusTestAppSpeedCadenceView(m_antplus);
        m_powerView = new AntPlusTestAppPowerView(m_antplus);

        m_speedViewDelegate = new AntPlusTestAppSpeedViewDelegate();
        m_speedCadenceViewDelegate = new AntPlusTestAppSpeedCadenceViewDelegate();
        m_powerViewDelegate = new AntPlusTestAppPowerViewDelegate();
    }

    function onMenuItem(item as Symbol) as Void {
        if (item == :item_1) {
            System.println("Speed");
            WatchUi.pushView(m_speedView, m_speedViewDelegate, WatchUi.SLIDE_UP);
        } else if (item == :item_2) {
            System.println("Speed Cadence");
            WatchUi.pushView(m_speedCadenceView, m_speedCadenceViewDelegate, WatchUi.SLIDE_UP);
        } else if (item == :item_3) {
            System.println("Power");
            WatchUi.pushView(m_powerView, m_powerViewDelegate, WatchUi.SLIDE_UP);
        }
    }

    function onMenuCancel() as Void {
        WatchUi.popView(WatchUi.SLIDE_DOWN);
    }
}