//! Error types for lazydomain
//!
//! This module defines all error types used throughout the application
//! using thiserror for proper Error trait implementations.

use thiserror::Error;

/// Main error type for lazydomain operations
#[derive(Error, Debug)]
pub enum LazyDomainError {
    /// RDAP query failed
    #[error("RDAP query failed for domain {domain}: {source}")]
    #[allow(dead_code)]
    RdapError {
        /// The domain that failed
        domain: String,
        /// The underlying error
        source: reqwest::Error,
    },

    /// WHOIS query failed
    #[error("WHOIS query failed for domain {domain}: {message}")]
    #[allow(dead_code)]
    WhoisError {
        /// The domain that failed
        domain: String,
        /// Error message
        message: String,
    },

    /// Invalid domain name
    #[error("Invalid domain name: {0}")]
    InvalidDomain(String),

    /// Configuration error
    #[error("Configuration error: {0}")]
    ConfigError(String),

    /// IO error
    #[error("IO error: {0}")]
    IoError(#[from] std::io::Error),

    /// Serialization error
    #[error("Serialization error: {0}")]
    SerializationError(String),

    /// TUI rendering error
    #[error("TUI error: {0}")]
    TuiError(String),

    /// Network timeout
    #[error("Network timeout for domain: {0}")]
    #[allow(dead_code)]
    Timeout(String),
}

/// Result type alias for lazydomain operations
pub type Result<T> = std::result::Result<T, LazyDomainError>;
