ua-client 0.1.0

Native OPC UA browser/inspector GUI built on async-opcua and egui
use opcua::types::{NodeClass, NodeId};

#[derive(Debug, Clone)]
pub struct TreeChild {
    pub node_id: NodeId,
    pub browse_name: String,
    pub display_name: String,
    pub node_class: NodeClass,
    pub has_children: bool,
}

#[derive(Debug, Clone)]
pub struct NodeSummary {
    pub node_id: NodeId,
    pub browse_name: String,
    pub display_name: String,
    pub node_class: NodeClass,
    pub description: Option<String>,
    pub value: Option<String>,
}

#[derive(Debug, Clone)]
pub struct AuthSpec {
    pub mode: AuthMode,
    pub username: String,
    pub password: String,
    pub cert_path: String,
    pub key_path: String,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum AuthMode {
    #[default]
    Anonymous,
    UserName,
    Certificate,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SecurityMode {
    None,
    Sign,
    SignAndEncrypt,
}

impl SecurityMode {
    pub fn label(self) -> &'static str {
        match self {
            SecurityMode::None => "None",
            SecurityMode::Sign => "Sign",
            SecurityMode::SignAndEncrypt => "SignAndEncrypt",
        }
    }
}

#[derive(Debug, Clone)]
pub struct EndpointInfo {
    pub endpoint_url: String,
    pub security_policy: String,
    pub security_policy_uri: String,
    pub security_mode: SecurityMode,
    pub security_level: u8,
    pub supports_anonymous: bool,
    pub supports_username: bool,
    pub supports_certificate: bool,
}

#[derive(Debug, Clone)]
pub struct ReferenceRow {
    pub reference_type: String,
    pub is_forward: bool,
    pub target_node_id: NodeId,
    pub target_browse_name: String,
    pub target_display_name: String,
    pub target_node_class: NodeClass,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LogLevel {
    Error,
    Warn,
    Info,
    Debug,
    Trace,
}

#[derive(Debug, Clone)]
pub struct LogLine {
    pub level: LogLevel,
    pub target: String,
    pub message: String,
}