use notan::prelude::*;

pub fn letter_to_option(key: KeyCode, shift: bool) -> Option<usize> {
    if shift {
        match key {
            KeyCode::A => Some(26),
            KeyCode::B => Some(27),
            KeyCode::C => Some(28),
            KeyCode::D => Some(29),
            KeyCode::E => Some(30),
            KeyCode::F => Some(31),
            KeyCode::G => Some(32),
            KeyCode::H => Some(33),
            KeyCode::I => Some(34),
            KeyCode::J => Some(35),
            KeyCode::K => Some(36),
            KeyCode::L => Some(37),
            KeyCode::M => Some(38),
            KeyCode::N => Some(39),
            KeyCode::O => Some(40),
            KeyCode::P => Some(41),
            KeyCode::Q => Some(42),
            KeyCode::R => Some(43),
            KeyCode::S => Some(44),
            KeyCode::T => Some(45),
            KeyCode::U => Some(46),
            KeyCode::V => Some(47),
            KeyCode::W => Some(48),
            KeyCode::X => Some(49),
            KeyCode::Y => Some(50),
            KeyCode::Z => Some(51),
            _ => None,
        }
    } else {
        match key {
            KeyCode::A => Some(0),
            KeyCode::B => Some(1),
            KeyCode::C => Some(2),
            KeyCode::D => Some(3),
            KeyCode::E => Some(4),
            KeyCode::F => Some(5),
            KeyCode::G => Some(6),
            KeyCode::H => Some(7),
            KeyCode::I => Some(8),
            KeyCode::J => Some(9),
            KeyCode::K => Some(10),
            KeyCode::L => Some(11),
            KeyCode::M => Some(12),
            KeyCode::N => Some(13),
            KeyCode::O => Some(14),
            KeyCode::P => Some(15),
            KeyCode::Q => Some(16),
            KeyCode::R => Some(17),
            KeyCode::S => Some(18),
            KeyCode::T => Some(19),
            KeyCode::U => Some(20),
            KeyCode::V => Some(21),
            KeyCode::W => Some(22),
            KeyCode::X => Some(23),
            KeyCode::Y => Some(24),
            KeyCode::Z => Some(25),
            _ => None,
        }
    }
}
