pub mod console;
pub mod detect;
pub mod eval;
pub mod frame;
pub mod health;
pub mod hide;
pub mod install;
pub mod isolate;
pub mod list_components;
pub mod open;
pub mod reveal;
pub mod screenshot;
pub mod show;
pub mod show_all;
pub mod status;
pub mod stop;
pub mod view;
pub mod view_library;
pub mod place_pin1;
pub mod set_overlay;
pub mod sign_off;
pub mod restart;

use colored::Colorize;

pub fn ok(msg: impl AsRef<str>) {
    println!("{} {}", "OK:".green().bold(), msg.as_ref());
}

pub fn err(msg: impl AsRef<str>) {
    eprintln!("{} {}", "ERROR:".red().bold(), msg.as_ref());
}

pub fn hint(msg: impl AsRef<str>) {
    eprintln!("{} {}", "Hint:".yellow().bold(), msg.as_ref());
}

pub const DEFAULT_PORT: u16 = 8871;

/// Service-step2glb base URL. Override at runtime with `STEP2GLB_SERVICE_API`.
pub const DEFAULT_STEP2GLB_URL: &str = "https://step2glb-gmdoncpxdwx0.adom.cloud";

pub fn step2glb_service_url() -> String {
    std::env::var("STEP2GLB_SERVICE_API")
        .unwrap_or_else(|_| DEFAULT_STEP2GLB_URL.to_string())
        .trim_end_matches('/')
        .to_string()
}