use thiserror::Error;
#[derive(Debug, Error)]
pub enum MvError {
#[error("materialized view already exists: {0}")]
DuplicateName(String),
#[error("source not found: {0}")]
SourceNotFound(String),
#[error("dependency cycle detected involving: {0}")]
CycleDetected(String),
#[error("materialized view not found: {0}")]
ViewNotFound(String),
#[error("operator not found for view: {0}")]
OperatorNotFound(String),
#[error("cannot drop view '{0}': dependent views exist: {1:?}")]
HasDependents(String, Vec<String>),
#[error("operator error: {0}")]
OperatorError(#[from] crate::operator::OperatorError),
#[error("serialization error: {0}")]
SerializationError(String),
#[error("view '{0}' is in invalid state: {1:?}")]
InvalidState(String, MvState),
#[error("watermark propagation error: {0}")]
WatermarkError(String),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum MvState {
#[default]
Running,
Dropping,
}