use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Menu<T: PartialEq + Eq> {
    current: Option<T>,
    options: Vec<T>,
}

impl<T: PartialEq + Eq> Menu<T> {
    pub fn new(options: Vec<T>, current: Option<T>) -> Menu<T> {
        if let Some(ref current) = current {
            assert!(options.contains(current));
        }
        Menu { current, options }
    }
}
