Skip to main content

supercode_interchange/world/
channel.rs

1//! A channel: one platform block of `config.yaml` (§2.4). Credential values
2//! never enter the model; they are references.
3
4use std::collections::BTreeMap;
5
6use schemars::JsonSchema;
7use serde::{Deserialize, Serialize};
8use serde_json::Value;
9
10use crate::ontology::SecretRef;
11
12/// One platform's configuration.
13#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
14pub struct ChannelConfig {
15    /// The platform name (`telegram`, `slack`, `api_server`, …).
16    pub platform: String,
17    /// Whether the adapter is enabled.
18    #[serde(default = "default_true")]
19    pub enabled: bool,
20    /// Credential keys by reference; presence is checked at load, values never held.
21    #[serde(default)]
22    pub credentials: BTreeMap<String, SecretRef>,
23    /// Adapter-specific settings, verbatim (`extra.<key>` for the nested block).
24    #[serde(default)]
25    pub extra: BTreeMap<String, Value>,
26}
27
28fn default_true() -> bool {
29    true
30}