use scirs2_core::error::CoreError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum TimeSeriesError {
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("Insufficient data: {message}. Need at least {required} observations, got {actual}")]
InsufficientData {
message: String,
required: usize,
actual: usize,
},
#[error("Invalid model configuration: {0}")]
InvalidModel(String),
#[error("Model fitting error: {0}")]
FittingError(String),
#[error("Forecasting error: {0}")]
ForecastingError(String),
#[error("Decomposition error: {0}")]
DecompositionError(String),
#[error("Feature extraction error: {0}")]
FeatureExtractionError(String),
#[error("Statistical error: {0}")]
StatisticalError(String),
#[error("Optimization error: {0}")]
OptimizationError(String),
#[error("Failed to converge after {iterations} iterations")]
ConvergenceError {
iterations: usize,
},
#[error("Numerical instability: {0}")]
NumericalInstability(String),
#[error("Computation error: {0}")]
ComputationError(String),
#[error("Dimension mismatch: expected {expected}, got {actual}")]
DimensionMismatch {
expected: usize,
actual: usize,
},
#[error("Invalid parameter '{name}': {message}")]
InvalidParameter {
name: String,
message: String,
},
#[error("Model not fitted: {0}")]
ModelNotFitted(String),
#[error("Not implemented: {0}")]
NotImplemented(String),
#[error("I/O error: {0}")]
IOError(String),
#[error("Invalid operation: {0}")]
InvalidOperation(String),
#[error("Error: {0}")]
Other(String),
#[error("Core error: {0}")]
CoreError(#[from] CoreError),
}
pub type Result<T> = std::result::Result<T, TimeSeriesError>;