use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use crate::reference::{CardRef, Ref};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
#[serde(tag = "type", content = "value", rename_all = "snake_case")]
pub enum ParameterValue {
Int(i64),
Float(f64),
Str(String),
Bool(bool),
Json(serde_json::Value),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
pub struct MetricEntry {
pub name: String,
pub value: f64,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub step: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub timestamp: Option<chrono::DateTime<chrono::Utc>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
#[serde(default)]
pub is_eval: bool,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
pub struct ProtocolProfile {
pub protocol: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub metadata: BTreeMap<String, NonSecretValue>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
pub struct AgentInterface {
pub name: String,
pub mode: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub schema_ref: Option<CardRef>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub metadata: BTreeMap<String, NonSecretValue>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
pub struct CredentialRef {
pub provider: String,
pub name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
#[serde(tag = "type", content = "value", rename_all = "snake_case")]
pub enum NonSecretValue {
Str(String),
Number(f64),
Bool(bool),
List(Vec<NonSecretValue>),
Object(BTreeMap<String, NonSecretValue>),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
pub struct Governance {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub policy_refs: Vec<Ref>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audit_ref: Option<Ref>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub approval_requirements: Vec<String>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub metadata: BTreeMap<String, NonSecretValue>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, schemars::JsonSchema)]
#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
pub struct ObservationHooks {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub route_refs: Vec<Ref>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub events: Vec<String>,
}