use std::{io, path::PathBuf, result};
pub mod config;
pub mod directory;
pub mod note;
pub mod vault;
mod vault_entry;
pub use config::ObsidianConfig;
pub use note::Note;
pub use vault::*;
pub use vault_entry::FindNote;
pub use vault_entry::VaultEntry;
pub type Result<T> = result::Result<T, Error>;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Path not found: {0}")]
PathNotFound(String),
#[error("Invalid path name: {0}")]
InvalidPathName(PathBuf),
#[error("Empty filename for path: {0}")]
EmptyFileName(PathBuf),
#[error("JSON (de)serialization error: {0}")]
Json(#[from] serde_json::Error),
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("Failed to find available name for '{name}' after {max_attempts} attempts")]
MaxAttemptsExceeded {
name: String,
max_attempts: usize,
},
}