use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct SpecChanged {
pub page_id: String,
pub kind: String,
pub at_ms: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum SpecApiEvent {
SpecChanged(SpecChanged),
SpecCheckInvoked {
snapshot_id: String,
page_ids: Vec<String>,
invoked_via: String,
at_ms: u64,
},
SpecCheckCompleted {
snapshot_id: String,
page_count: usize,
overall_match_rate: f32,
perfect_match_count: usize,
partial_match_count: usize,
no_match_count: usize,
eval_error_count: usize,
total_duration_ms: u64,
at_ms: u64,
},
SpecCheckPolicyViolation {
snapshot_id: String,
page_id: String,
conjunct_name: String,
rule_kind: String,
observed: serde_json::Value,
at_ms: u64,
},
FlywheelProposalPromoted {
proposal_id: String,
page_id: String,
consecutive_greens: u32,
snapshot_id: String,
at_ms: u64,
},
FlywheelProposalDemoted {
proposal_id: String,
page_id: String,
failing_assertion_id: String,
failing_state_id: String,
snapshot_id: String,
at_ms: u64,
},
}