use thiserror::Error;
pub type Result<T> = std::result::Result<T, PluginError>;
#[derive(Debug, Error)]
pub enum PluginError {
#[error("template not found: {0}")]
TemplateNotFound(String),
#[error("template validation failed: {0}")]
TemplateValidationError(String),
#[error("selector evaluation failed: {selector}, reason: {reason}")]
SelectorError { selector: String, reason: String },
#[error("extraction failed: {0}")]
ExtractionError(String),
#[error("extraction already completed with idempotency key: {0}")]
IdempotencyDuplicate(String),
#[error("idempotency store error: {0}")]
IdempotencyStoreError(String),
#[error("template storage error: {0}")]
StorageError(String),
#[error("serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
#[error("io error: {0}")]
IoError(#[from] std::io::Error),
#[error("timeout occurred")]
Timeout,
#[error("invalid transformation: {0}")]
InvalidTransformation(String),
#[error("schema validation failed: {0}")]
SchemaValidationError(String),
#[error("{0}")]
Other(String),
}