use crate::TU;

pub const DEFAULT_DEBOUNCE: TU = 10;
pub const DEFAULT_RELEASE: TU = 250;
pub const DEFAULT_HOLD: TU = 600;
pub const DEFAULT_LONG_PRESS: TU = 2000;

pub trait KeyConfig {
    const DEBOUNCE: TU;
    const RELEASE: TU;
    const HOLD: TU;
    #[cfg(feature = "long-press")]
    const LONG_PRESS: LongPress;
}

pub struct DefaultConfig;

impl KeyConfig for DefaultConfig {
    const DEBOUNCE: TU = DEFAULT_DEBOUNCE;
    const RELEASE: TU = DEFAULT_RELEASE;
    const HOLD: TU = DEFAULT_HOLD;
    #[cfg(feature = "long-press")]
    const LONG_PRESS: LongPress = LongPress::Single(DEFAULT_LONG_PRESS);
}

/// Long press configuration.
///
/// - `Single(TU)`: Triggers once when the hold duration exceeds the threshold.
/// - `Repeat(TU, TU)`: Triggers repeatedly at the given interval while held,
///   after an initial delay.
#[cfg(feature = "long-press")]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LongPress {
    Single(TU),
    #[cfg(feature = "long-press-repeat")]
    Repeat(TU, TU),
}
