use std::collections::BTreeMap;
use std::path::PathBuf;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use super::{Access, ChannelConfig, Fire, Job, Obligation, Route, WebhookSubscription, WorkerSpec};
use crate::ontology::Binding;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct PersonaRef {
pub path: String,
#[serde(default)]
pub text: Option<String>,
pub sha256: String,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct ProfileResidue {
#[serde(default)]
pub config: BTreeMap<String, Value>,
#[serde(default)]
pub files: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct Profile {
pub name: String,
pub dir: PathBuf,
#[serde(default)]
pub worker: Option<WorkerSpec>,
#[serde(default)]
pub persona: Option<PersonaRef>,
#[serde(default)]
pub channels: BTreeMap<String, ChannelConfig>,
#[serde(default)]
pub routes: Vec<Route>,
#[serde(default)]
pub jobs: BTreeMap<String, Job>,
#[serde(default)]
pub subscriptions: BTreeMap<String, WebhookSubscription>,
#[serde(default)]
pub access: Access,
#[serde(default)]
pub bindings: BTreeMap<String, Binding>,
#[serde(default)]
pub fires: Vec<Fire>,
#[serde(default)]
pub obligations: Vec<Obligation>,
#[serde(default)]
pub residue: ProfileResidue,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct Orchestration {
pub root: PathBuf,
pub profiles: BTreeMap<String, Profile>,
}