tf-types 0.1.8

Core semantic types, traits, and schemas powering the TrustForge protocol.
Documentation
// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.

#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]

use serde::{Deserialize, Serialize};
use super::*;

/// Rule describing how a given event type is recorded.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct EmitRule {
    /// Event type identifier this rule applies to, e.g. session.established.
    pub event_type: String,
    /// Proof level at which this event must be emitted.
    pub level: ProofLevel,
    /// Where the event is anchored.
    pub anchor: EmitRule_Anchor,
    /// Retention period in days (0 = indefinite).
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub retention_days: Option<i64>,
}

/// Where the event is anchored.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum EmitRule_Anchor {
    #[serde(rename = "local")]
    Local,
    #[serde(rename = "org")]
    Org,
    #[serde(rename = "federated")]
    Federated,
    #[serde(rename = "transparency")]
    Transparency,
    #[serde(rename = "none")]
    None,
}

/// Declarative profile describing which proof events to emit and how (TF-0005).
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProofProfile {
    /// Version of the proof-profile manifest schema itself.
    pub profile_version: ProofProfile_ProfileVersion,
    /// Trust domain this profile applies to.
    pub trust_domain: TrustDomain,
    /// Default proof level when an event has none explicitly set.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub default_level: Option<ProofLevel>,
    /// Event-emission rules, evaluated per emitted event.
    pub emit: Vec<EmitRule>,
    /// Field-level redaction applied before anchoring.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub redaction_rules: Option<Vec<RedactionRule>>,
}

/// Version of the proof-profile manifest schema itself.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum ProofProfile_ProfileVersion {
    #[serde(rename = "1")]
    V1,
}

/// Redaction applied to a field before anchoring.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct RedactionRule {
    /// JSON Pointer into the event payload.
    pub field: String,
    /// How the field is treated.
    pub policy: RedactionRule_Policy,
}

/// How the field is treated.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RedactionRule_Policy {
    #[serde(rename = "keep")]
    Keep,
    #[serde(rename = "hash")]
    Hash,
    #[serde(rename = "drop")]
    Drop,
}