use systemprompt_analytics::AnalyticsError;
use systemprompt_config::{ConfigError as ProfileConfigError, ProfileBootstrapError};
use systemprompt_database::RepositoryError;
use systemprompt_extension::LoaderError;
use systemprompt_files::FilesError;
use systemprompt_models::errors::ConfigError as ModelConfigError;
use systemprompt_models::paths::PathError;
use systemprompt_users::UserError;
use thiserror::Error;
pub type RuntimeResult<T> = Result<T, RuntimeError>;
#[derive(Debug, Error)]
pub enum RuntimeError {
#[error(transparent)]
Profile(#[from] ProfileConfigError),
#[error(transparent)]
ProfileBootstrap(#[from] ProfileBootstrapError),
#[error(transparent)]
Config(#[from] ModelConfigError),
#[error(transparent)]
Paths(#[from] PathError),
#[error(transparent)]
Files(#[from] FilesError),
#[error(transparent)]
Users(#[from] UserError),
#[error(transparent)]
Repository(#[from] RepositoryError),
#[error(transparent)]
Analytics(#[from] AnalyticsError),
#[error(transparent)]
Loader(#[from] LoaderError),
#[error("DATABASE_URL is empty")]
EmptyDatabaseUrl,
#[error("Database not found at '{path}'. Run setup first")]
DatabaseNotFound { path: String },
#[error("Database path '{path}' exists but is not a file")]
DatabaseNotFile { path: String },
#[error("internal: {0}")]
Internal(String),
}