use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[repr(u8)]
pub enum UniverseLevel {
U0Mcard = 0,
U1Pcard = 1,
U2Vcard = 2,
U3Satori = 3,
U4Membrane = 4,
U5MetaGamma = 5,
}
impl UniverseLevel {
pub fn from_u8(val: u8) -> Result<Self, String> {
match val {
0 => Ok(Self::U0Mcard),
1 => Ok(Self::U1Pcard),
2 => Ok(Self::U2Vcard),
3 => Ok(Self::U3Satori),
4 => Ok(Self::U4Membrane),
5 => Ok(Self::U5MetaGamma),
other => Err(format!("Invalid universe level: {other} (expected 0..=5)")),
}
}
pub fn as_u8(&self) -> u8 {
*self as u8
}
pub fn identifier(&self) -> &'static str {
match self {
Self::U0Mcard => "U0",
Self::U1Pcard => "U1",
Self::U2Vcard => "U2",
Self::U3Satori => "U3",
Self::U4Membrane => "U4",
Self::U5MetaGamma => "U5",
}
}
pub fn stratum_name(&self) -> &'static str {
match self {
Self::U0Mcard => "mcard_cas",
Self::U1Pcard => "pcard_net",
Self::U2Vcard => "vcard_proof",
Self::U3Satori => "satori_fiber",
Self::U4Membrane => "membrane_ui",
Self::U5MetaGamma => "meta_gamma",
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct LatticeCoordinate {
pub level: u8,
pub identifier: String,
pub stratum_name: String,
pub description: String,
}
pub fn get_universe_coordinates() -> Vec<LatticeCoordinate> {
vec![
LatticeCoordinate {
level: 0,
identifier: "U0".to_string(),
stratum_name: "mcard_cas".to_string(),
description: "Static Content-Addressable Storage (MCard)".to_string(),
},
LatticeCoordinate {
level: 1,
identifier: "U1".to_string(),
stratum_name: "pcard_net".to_string(),
description: "Linear Transitions & Colored Petri Net (PCard)".to_string(),
},
LatticeCoordinate {
level: 2,
identifier: "U2".to_string(),
stratum_name: "vcard_proof".to_string(),
description: "Cryptographic Verification & Hoare Receipts (VCard)".to_string(),
},
LatticeCoordinate {
level: 3,
identifier: "U3".to_string(),
stratum_name: "satori_fiber".to_string(),
description: "Distributed Reticulum Mesh & Satori Speech Acts".to_string(),
},
LatticeCoordinate {
level: 4,
identifier: "U4".to_string(),
stratum_name: "membrane_ui".to_string(),
description: "Omnichannel Interaction Surface & Generative Hypermedia".to_string(),
},
LatticeCoordinate {
level: 5,
identifier: "U5".to_string(),
stratum_name: "meta_gamma".to_string(),
description: "Meta-Circular Continuous Learning Stratum (Loop Γ)".to_string(),
},
]
}
pub fn is_stratified(inner_level: u8, outer_level: u8) -> bool {
inner_level <= outer_level
}
pub fn validate_universe_level(level: u8) -> Result<UniverseLevel, String> {
UniverseLevel::from_u8(level)
}