//! Corrosion wire protocol v2 subject scheme (see PROTOCOL.md).
//!
//! Host-level subjects live under `corrosion.{license}.host.*`; per-instance
//! subjects under `corrosion.{license}.{instance_id}.*`. Instance ids are
//! validated at config load so they can never collide with the reserved
//! `host` segment or contain subject metacharacters.

pub fn host_heartbeat(license: &str) -> String {
    format!("corrosion.{license}.host.heartbeat")
}

pub fn host_cmd(license: &str) -> String {
    format!("corrosion.{license}.host.cmd")
}

pub fn host_going_offline(license: &str) -> String {
    format!("corrosion.{license}.host.going_offline")
}

/// Per-instance command channel (start/stop/restart/status; rcon et al. to come).
pub fn instance_cmd(license: &str, instance: &str) -> String {
    format!("corrosion.{license}.{instance}.cmd")
}

/// Per-instance state-change events.
pub fn instance_status(license: &str, instance: &str) -> String {
    format!("corrosion.{license}.{instance}.status")
}

/// Per-instance SteamCMD progress stream.  Lines from `steamcmd` stdout are
/// published here so the panel can display live update output.
pub fn instance_steam_status(license: &str, instance: &str) -> String {
    format!("corrosion.{license}.{instance}.steam_status")
}

/// Per-instance file manager command channel (request-reply).
pub fn instance_files_cmd(license: &str, instance: &str) -> String {
    format!("corrosion.{license}.{instance}.files.cmd")
}
