use serde::{Deserialize, Serialize};
use crate::agent::swarm::config::{CollaborationSection, ConflictResolution, SwarmStrategy};
use super::provider::AgentsSection;
use super::provider::{ModelOverride, ProviderEntry};
use super::rag::RagSection;
use super::remote::{
ChannelMappingEntry, DiscordSection, RemoteSection, SlackSection, TelegramSection, WebSection,
};
use super::sections::{
AgentSection, ApiSection, BenchSection, ContextSection, DebugSection, EvolutionSection,
HooksSection, PathsSection, SecuritySection, SoulSection, TelemetrySection, UiSection,
};
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct ConfigFile {
#[serde(default, rename = "default", alias = "api")]
pub api: ApiSection,
#[serde(default)]
pub agent: AgentSection,
#[serde(default)]
pub agents: AgentsSection,
#[serde(default)]
pub context: ContextSection,
#[serde(default)]
pub hooks: HooksSection,
#[serde(default)]
pub ui: UiSection,
#[serde(default)]
pub bench: BenchSection,
#[serde(default)]
pub collaboration: CollaborationSection,
#[serde(default)]
pub debug: DebugSection,
#[serde(default)]
pub paths: PathsSection,
#[serde(default)]
pub web: WebSection,
#[serde(default)]
pub security: SecuritySection,
#[serde(default)]
pub rag: RagSection,
#[serde(default)]
pub soul: SoulSection,
#[serde(default)]
pub evolution: EvolutionSection,
#[serde(default)]
pub telemetry: TelemetrySection,
#[serde(default)]
pub remote: RemoteSection,
#[serde(default)]
pub telegram: TelegramSection,
#[serde(default)]
pub slack: SlackSection,
#[serde(default)]
pub discord: DiscordSection,
#[serde(default)]
pub channel_map: Vec<ChannelMappingEntry>,
#[serde(default)]
pub proxy_headers: std::collections::HashMap<String, String>,
#[serde(default)]
pub fork: Option<LegacyForkSection>,
#[serde(default)]
pub hive: Option<LegacyHiveSection>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub models: Vec<ModelOverride>,
#[serde(default)]
pub providers: Vec<ProviderEntry>,
}
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct LegacyForkSection {
pub enabled: Option<bool>,
pub max_agents: Option<usize>,
pub worker_model: Option<String>,
pub worktree: Option<bool>,
pub auto_suggest: Option<bool>,
}
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct LegacyHiveSection {
pub enabled: Option<bool>,
pub max_agents: Option<usize>,
pub strategy: Option<SwarmStrategy>,
pub coordinator_model: Option<String>,
pub worker_model: Option<String>,
pub require_consensus: Option<bool>,
pub conflict_resolution: Option<ConflictResolution>,
pub auto_suggest: Option<bool>,
}