use std::collections::HashMap;
use secrecy::zeroize::ZeroizeOnDrop;
use secrecy::Zeroize;
use serde::{Deserialize, Serialize};
use crate::link::InterfaceLinkDefinition;
use crate::logging::Level;
use crate::otel::OtelConfig;
use crate::secrets::SecretValue;
use crate::wit::{deserialize_wit_map, serialize_wit_map, WitMap};
pub type HostEnvValues = WitMap<String>;
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct HostData {
#[serde(default)]
pub host_id: String,
#[serde(default)]
pub lattice_rpc_prefix: String,
#[serde(default)]
pub link_name: String,
#[serde(default)]
pub lattice_rpc_user_jwt: String,
#[serde(default)]
pub lattice_rpc_user_seed: String,
#[serde(default)]
pub lattice_rpc_url: String,
#[serde(default)]
pub provider_key: String,
#[serde(
serialize_with = "serialize_wit_map",
deserialize_with = "deserialize_wit_map"
)]
pub env_values: HostEnvValues,
#[serde(default)]
pub instance_id: String,
pub link_definitions: Vec<InterfaceLinkDefinition>,
#[serde(default)]
pub cluster_issuers: Vec<String>,
#[serde(default)]
pub config: HashMap<String, String>,
#[serde(default)]
pub secrets: HashMap<String, SecretValue>,
#[serde(default)]
pub host_xkey_public_key: String,
#[serde(default)]
pub provider_xkey_private_key: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub default_rpc_timeout_ms: Option<u64>,
#[serde(default)]
pub structured_logging: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub log_level: Option<Level>,
#[serde(default)]
pub otel_config: OtelConfig,
}
impl ZeroizeOnDrop for HostData {}
impl Zeroize for HostData {
fn zeroize(&mut self) {
self.provider_xkey_private_key.zeroize();
}
}