// Copyright (c) Subzero Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use thiserror::Error;

/// Errors that can occur during pub/sub matching operations
#[derive(Error, Debug)]
pub enum MatcherError {
    /// Error when an event is missing a required attribute
    #[error("Event is missing required attribute: {0}")]
    MissingAttribute(String),

    /// Error when an event's attribute has an incompatible type
    #[error("Attribute '{0}' has incompatible type")]
    IncompatibleAttributeType(String),

    /// Error when a subscription contains an invalid predicate
    #[error("Invalid predicate in subscription: {0}")]
    InvalidPredicate(String),

    /// Error when building the matching tree
    #[error("Failed to build matching tree: {0}")]
    TreeBuildError(String),

    /// Error during the matching process
    #[error("Matching error: {0}")]
    MatchingError(String),

    /// Error when serializing or deserializing data
    #[error("Serialization error: {0}")]
    SerializationError(String),

    /// Any other error that might occur
    #[error("Unexpected error: {0}")]
    Other(String),
}
