pub(crate) type Result<T> = core::result::Result<T, NihilityListenerError>;

#[derive(thiserror::Error, Debug)]
pub enum NihilityListenerError {
    #[error(transparent)]
    IO(#[from] std::io::Error),
    #[error(transparent)]
    Ort(#[from] ort::Error),
    #[error(transparent)]
    ParamShape(#[from] ndarray::ShapeError),
    #[error(transparent)]
    AudioDevices(#[from] cpal::DevicesError),
    #[error(transparent)]
    AudioDeviceName(#[from] cpal::DeviceNameError),
    #[error(transparent)]
    AudioSupportedStreamConfigs(#[from] cpal::SupportedStreamConfigsError),
    #[error(transparent)]
    AudioBuildStream(#[from] cpal::BuildStreamError),
    #[error(transparent)]
    AudioPlayStream(#[from] cpal::PlayStreamError),
    #[error(transparent)]
    AudioPauseStream(#[from] cpal::PauseStreamError),
    #[error(transparent)]
    SpeechSend(#[from] tokio::sync::broadcast::error::SendError<Vec<f32>>),
    #[error(transparent)]
    AsrResultSend(#[from] tokio::sync::broadcast::error::SendError<String>),
    #[error(transparent)]
    ReadNpy(#[from] ndarray_npy::ReadNpyError),
    #[error(transparent)]
    Config(#[from] nihility_config::NihilityConfigError),
    #[error("Nihility asr initialization error: {0}")]
    Init(String),
    #[error("Model output error: {0}")]
    ModelOutput(String),
    #[error("Unknown error: {0}")]
    Unknown(String),
}
