tf-types 0.1.6

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::*;

/// Standalone signed/encrypted object that may be delivered offline, relayed, stored, or transferred and verified later. Implements TF-0011 packet mode: packet priority, expiration, route constraints, fragmentation, emergency packets.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Packet {
    /// Version of the packet schema itself.
    pub packet_version: Packet_PacketVersion,
    /// Stable packet identifier; used for de-duplication, fragmentation reassembly, and audit lookup.
    pub packet_id: String,
    /// Originating actor.
    pub source: ActorId,
    /// Final destination actor.
    pub destination: ActorId,
    /// Packet priority class. P0 is reserved for emergency / break-glass and is policy-controlled.
    pub priority: Packet_Priority,
    /// When true, the packet is invoking break-glass emergency authority. Must be scoped, logged, and reviewable per TF-0011.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub emergency: Option<bool>,
    pub created_at: Timestamp,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_at: Option<Timestamp>,
    /// Maximum number of relay hops the packet may traverse.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub ttl_hops: Option<i64>,
    /// Optional ordered/unordered hints ("only-trusted-relays", "avoid:internet", ...).
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub route_constraints: Option<Vec<String>>,
    /// Wire encoding of the payload bytes.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub encoding: Option<Packet_Encoding>,
    /// Optional payload compression.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub compression: Option<Packet_Compression>,
    /// Base64-encoded canonical payload bytes (the body the source signed).
    pub payload: String,
    /// Optional session identifier this packet relates to.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub session_ref: Option<String>,
    /// Set when the packet is itself a fragment of a larger packet.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub fragment: Option<PacketFragment>,
    pub signature: SignatureEnvelope,
}

/// Optional payload compression.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Packet_Compression {
    #[serde(rename = "none")]
    None,
    #[serde(rename = "deflate")]
    Deflate,
}

/// Wire encoding of the payload bytes.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Packet_Encoding {
    #[serde(rename = "json")]
    Json,
    #[serde(rename = "cbor")]
    Cbor,
}

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

/// Packet priority class. P0 is reserved for emergency / break-glass and is policy-controlled.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Packet_Priority {
    #[serde(rename = "P0")]
    P0,
    #[serde(rename = "P1")]
    P1,
    #[serde(rename = "P2")]
    P2,
    #[serde(rename = "P3")]
    P3,
    #[serde(rename = "P4")]
    P4,
    #[serde(rename = "P5")]
    P5,
}