package ru.kirillius.cooler.controller.CLI;

public abstract class SubmenuItem<T, M extends Menu<V>, V> implements MenuItem<T> {
    private final Menu<V> menu;

    public SubmenuItem(Menu<V> menu) {
        this.menu = menu;
    }

    @Override
    public String render() {
        return menu.getName();
    }

    @Override
    public final T select() {
        return OnSelected(menu.show());
    }

    protected abstract T OnSelected(V value);
}
