use crate::config::types::ServerConfig;
pub(super) fn validate_agent_places(config: &ServerConfig, errors: &mut Vec<String>) {
let lys = config.auth.as_ref().and_then(|auth| auth.lys.as_ref());
if config.agents.is_some() && lys.is_some_and(|lys| lys.agents.is_some()) {
errors.push(
"agents are written once: at the top level or under [auth.lys], not both".to_owned(),
);
}
if config.agents.is_some() && config.auth.is_some() && lys.is_none() {
errors.push(
"agents: a gated exchange places stations in Lys, write [auth.lys] or remove [auth]"
.to_owned(),
);
}
if config.agents_config().is_some() && config.limits.max_channels.is_none() {
errors.push(
"agents: each station's inbox is a channel registered at runtime; write [limits] \
max_channels"
.to_owned(),
);
}
if let Some(Err(error)) = config.agents.map(|agents| agents.validate()) {
errors.push(format!("agents: {error}"));
}
}