pub mod core;
pub mod database;
pub mod media;
pub mod playback;
pub mod scanner;
use database::DatabaseError;
use thiserror::Error;

#[derive(Debug, Error, PartialEq)]
pub enum Error {
    #[error("Database error: {0}")]
    DatabaseError(DatabaseError),

    #[error("Cannot play track")]
    CannotPlay(String),

    #[error("Cannot stop playback")]
    CannotStop,

    #[error("Unmatched glib error: {0}")]
    GlibError(gstreamer::glib::Error),
}

impl From<DatabaseError> for Error {
    fn from(err: DatabaseError) -> Self {
        Self::DatabaseError(err)
    }
}

#[derive(Debug, Error, PartialEq)]
pub enum FatalError {
    #[error("Unexpected error")]
    UnexpectedError,
}

impl flow::FatalError for FatalError {}
