use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SenseOutput {
pub uri: String,
pub data: Value,
pub trace: Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SearchOutput {
pub query: String,
pub synapse: String,
pub count: usize,
pub results: Vec<Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TasteDownloadOutput {
pub uri: String,
pub cache_path: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub synopsis: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parent: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub taste: Option<TasteVerdict>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_tastes: Option<Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TasteVerdict {
pub verdict: substrate::TasteVerdict,
#[serde(skip_serializing_if = "Option::is_none")]
pub notes: Option<String>,
pub tasted_at_epoch_ms: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TasteRecordOutput {
pub uri: String,
pub verdict: substrate::TasteVerdict,
#[serde(skip_serializing_if = "Option::is_none")]
pub notes: Option<String>,
pub tasted_at_epoch_ms: u64,
#[serde(skip_serializing_if = "Option::is_none")]
pub shared: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub synapse: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub share_error: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TasteOutput {
Download(TasteDownloadOutput),
Record(TasteRecordOutput),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpawnOutput {
pub uri: String,
pub name: String,
pub path: String,
pub source_type: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub vcs: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "status")]
pub enum GrowOutput {
#[serde(rename = "updated")]
Updated {
uri: String,
old_hash: String,
new_hash: String,
method: String,
path: String,
},
#[serde(rename = "up_to_date")]
UpToDate { uri: String, hash: String },
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BondedRef {
pub uri: String,
pub relation: substrate::BondRelation,
pub status: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondOutput {
pub bonded: Vec<BondedRef>,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondStatusRef {
pub uri: String,
pub relation: substrate::BondRelation,
pub bonded: Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondStatusOutput {
pub bonds: Vec<BondStatusRef>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondCleanOutput {
pub cleaned: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondTasteRef {
pub uri: String,
pub relation: substrate::BondRelation,
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
pub taste: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondTasteRequired {
pub refs: Vec<BondTasteRef>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BondResult {
Bond(BondOutput),
Status(BondStatusOutput),
Clean(BondCleanOutput),
TasteRequired(BondTasteRequired),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LineageNode {
pub uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub domain: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub depth: Option<u32>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BondsOutput {
pub uri: String,
pub hash: String,
pub synapse: String,
pub direction: String,
pub max_depth: u32,
pub max_depth_reached: bool,
pub count: usize,
pub bonds: Vec<Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AbsorbSourceInfo {
pub uri: String,
pub hash: String,
pub name: String,
pub path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AbsorbOutput {
pub sources: Vec<AbsorbSourceInfo>,
pub prompt_path: String,
}