idiolect-records 0.1.0

Rust record types mirroring the dev.idiolect.* Lexicon family.
Documentation
// @generated by idiolect-codegen. do not edit.
// source: dev.idiolect.retrospection

//! A signed annotation of a prior encounter with a delayed finding. Retrospections address silent-error latency: merges, migrations, and bitemporal reconciliations often surface failures only after long delay.

#![allow(
    missing_docs,
    clippy::doc_markdown,
    clippy::struct_excessive_bools,
    clippy::derive_partial_eq_without_eq
)]
use serde::{Deserialize, Serialize};

/// Attribution and detection of a latent issue in a prior encounter. Causal claims are the publisher's judgment; disputes are themselves first-class records.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Retrospection {
    /// Optional confidence score in [0, 1]. Omit when the finding is unambiguous.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub confidence: Option<f64>,
    pub detected_at: String,
    /// DID of the party that detected the issue.
    pub detecting_party: String,
    /// True if the detecting party anticipates the causal attribution will be contested. A hint, not a fact; contest records are separate.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub disputed_attribution: Option<bool>,
    pub encounter: super::defs::EncounterRef,
    /// Structured finding kind plus free-text detail.
    pub finding: RetrospectionFinding,
    /// Detection latency in seconds (detectedAt - encounter.occurredAt). Precomputed for easy aggregation; may be omitted for 'other' findings where latency is not meaningful.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub latency: Option<i64>,
    /// When this retrospection record was published.
    pub occurred_at: String,
}

impl crate::Record for Retrospection {
    const NSID: &'static str = "dev.idiolect.retrospection";
}

/// Structured finding kind plus free-text detail.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RetrospectionFinding {
    pub detail: String,
    pub kind: RetrospectionFindingKind,
}
/// RetrospectionFindingKind.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum RetrospectionFindingKind {
    MergeDivergence,
    DataLoss,
    ReconciliationMismatch,
    Other,
}