use thiserror::Error;

#[derive(Debug, Error)]
pub enum A2aClientError {
    #[error("HTTP error: {0}")]
    HttpError(#[from] reqwest::Error),

    #[error("Serialization error: {0}")]
    SerdeError(#[from] serde_json::error::Error),

    #[error("Task not found: {0}")]
    TaskNotFound(String),

    #[error("Server error: {code} - {message}")]
    ServerError { code: i32, message: String },

    #[error("Connection refused to {0}")]
    ConnectionRefused(String),

    #[error("Invalid response from server")]
    InvalidResponse,

    #[error("Timeout connecting to {0}")]
    Timeout(String),

    #[error("Internal error: {0}")]
    InternalError(String),
}

pub type Result<T> = std::result::Result<T, A2aClientError>;
