/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2026 Mike Robeson [dijksterhuis]
*/

pub mod audio;
pub mod errors;
pub mod projects;
pub mod sample_files;

/// Highest level error variants for the crate
#[derive(Debug, thiserror::Error)]
pub enum OtToolsInterfacesError {
    #[error("File OS Error: {source} Path={path} (std::io::Error)")]
    FileOs {
        #[source]
        source: std::io::Error,
        path: std::path::PathBuf,
    },
    #[error("File I/O Error: {0} (std::io::Error)")]
    FileIo(#[from] std::io::Error),
    #[error("Walkdir error: {0}")]
    DirEntry(#[from] walkdir::Error),
    #[error("OtToolsIoError: {0}")]
    OtToolsIo(#[from] ot_tools_io::OtToolsIoError),
    #[error("AudioError: {0}")]
    Audio(#[from] audio::AudioErrors),
    #[error("ProjectsError: {0}")]
    Projects(#[from] projects::ProjectsErrors),
    #[error("SampleFilesError: {0}")]
    SampleFiles(#[from] sample_files::SampleFilesErrors),
}

/// Result alias standardizing [`OtToolsInterfacesError`] usage throughout the
/// library
type R<T> = Result<T, OtToolsInterfacesError>;

pub mod prelude {
    #[doc(inline)]
    pub use super::audio::AudioFile;
    #[doc(inline)]
    pub use super::projects::{OctatrackProject, OctatrackProjectState};
    #[doc(inline)]
    pub use super::sample_files::{CommitFiles, ReadFiles};
    #[doc(inline)]
    pub use super::sample_files::{EagerSampleFilePair, EagerSampleFilePairs};
    #[doc(inline)]
    pub use super::sample_files::{LazySampleFilePair, LazySampleFilePairs};
    #[doc(inline)]
    pub use super::sample_files::{ReadFile, WriteFile};
}
