use thiserror::Error;
pub type SyncResult<T> = Result<T, SyncError>;
#[derive(Error, Debug)]
pub enum SyncError {
#[error("Concurrent events detected: {0}")]
ConcurrentEvents(String),
#[error("Invalid operation: {0}")]
InvalidOperation(String),
#[error("Merkle tree verification failed: {0}")]
MerkleVerificationFailed(String),
#[error("Delta encoding error: {0}")]
DeltaEncodingError(String),
#[error("Device coordination error: {0}")]
CoordinationError(String),
#[error("CRDT merge conflict: {0}")]
MergeConflict(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[error("JSON error: {0}")]
JsonError(#[from] serde_json::Error),
#[error("Invalid device ID: {0}")]
InvalidDeviceId(String),
#[error("Operation timeout: {0}")]
Timeout(String),
#[error("Network error: {0}")]
NetworkError(String),
#[error("State inconsistency: {0}")]
StateInconsistency(String),
}