123 lines
3.4 KiB
Rust
123 lines
3.4 KiB
Rust
//! 主权管理模块
|
||
|
||
///! # 主权管理系统
|
||
///!
|
||
///! UID: nac.governance.Sovereignty.v1
|
||
///!
|
||
///! NAC的核心创新:将资产所有权细分为7种主权类型(A0-G5)
|
||
|
||
use serde::{Deserialize, Serialize};
|
||
|
||
/// 主权权益类型(A0-G5)- 从主权类关系衡生出的具体权益
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||
pub enum SovereigntyRight {
|
||
/// A0: 绝对所有权(Absolute Ownership)
|
||
/// - 完全控制权
|
||
/// - 无限制转让
|
||
/// - 无期限限制
|
||
A0,
|
||
|
||
/// B1: 使用权(Usage Rights)
|
||
/// - 有期限限制
|
||
/// - 可转让但不可分割
|
||
/// - 到期自动失效
|
||
B1,
|
||
|
||
/// C2: 收益权(Income Rights)
|
||
/// - 享有资产收益分配权
|
||
/// - 可转让
|
||
/// - 无所有权
|
||
C2,
|
||
|
||
/// D0: 担保主权(Collateral Sovereignty)
|
||
/// - 作为抵押品的权利
|
||
/// - 受限转让
|
||
/// - 清算条件触发时失效
|
||
D0,
|
||
|
||
/// E3: 知识产权(Intellectual Property)
|
||
/// - 专利、版权、商标等
|
||
/// - 许可使用
|
||
/// - 有地域和时间限制
|
||
E3,
|
||
|
||
/// F4: 临时监管权(Temporary Custody)
|
||
/// - 托管期间的管理权
|
||
/// - 不可转让
|
||
/// - 托管结束自动归还
|
||
F4,
|
||
|
||
/// G5: 共有权(Co-ownership)
|
||
/// - 多方共同所有
|
||
/// - 需要共有人同意才能转让
|
||
/// - 份额可分割
|
||
G5,
|
||
}
|
||
|
||
impl SovereigntyRight {
|
||
/// 获取主权类型的代码
|
||
pub fn code(&self) -> &'static str {
|
||
match self {
|
||
SovereigntyRight::A0 => "A0",
|
||
SovereigntyRight::B1 => "B1",
|
||
SovereigntyRight::C2 => "C2",
|
||
SovereigntyRight::D0 => "D0",
|
||
SovereigntyRight::E3 => "E3",
|
||
SovereigntyRight::F4 => "F4",
|
||
SovereigntyRight::G5 => "G5",
|
||
}
|
||
}
|
||
|
||
/// 获取主权类型的名称
|
||
pub fn name(&self) -> &'static str {
|
||
match self {
|
||
SovereigntyRight::A0 => "Absolute Ownership",
|
||
SovereigntyRight::B1 => "Usage Rights",
|
||
SovereigntyRight::C2 => "Income Rights",
|
||
SovereigntyRight::D0 => "Collateral Sovereignty",
|
||
SovereigntyRight::E3 => "Intellectual Property",
|
||
SovereigntyRight::F4 => "Temporary Custody",
|
||
SovereigntyRight::G5 => "Co-ownership",
|
||
}
|
||
}
|
||
|
||
/// 是否可以无限制转让
|
||
pub fn is_freely_transferable(&self) -> bool {
|
||
matches!(self, SovereigntyRight::A0 | SovereigntyRight::C2)
|
||
}
|
||
|
||
/// 是否有期限限制
|
||
pub fn has_expiry(&self) -> bool {
|
||
matches!(self, SovereigntyRight::B1 | SovereigntyRight::E3 | SovereigntyRight::F4)
|
||
}
|
||
|
||
/// 是否需要多方同意
|
||
pub fn requires_multi_approval(&self) -> bool {
|
||
matches!(self, SovereigntyRight::G5)
|
||
}
|
||
}
|
||
|
||
#[cfg(test)]
|
||
mod tests {
|
||
use super::*;
|
||
|
||
#[test]
|
||
fn test_sovereignty_type_code() {
|
||
assert_eq!(SovereigntyRight::A0.code(), "A0");
|
||
assert_eq!(SovereigntyRight::B1.code(), "B1");
|
||
assert_eq!(SovereigntyRight::G5.code(), "G5");
|
||
}
|
||
|
||
#[test]
|
||
fn test_sovereignty_transferability() {
|
||
assert!(SovereigntyRight::A0.is_freely_transferable());
|
||
assert!(!SovereigntyRight::F4.is_freely_transferable());
|
||
}
|
||
|
||
#[test]
|
||
fn test_sovereignty_expiry() {
|
||
assert!(SovereigntyRight::B1.has_expiry());
|
||
assert!(!SovereigntyRight::A0.has_expiry());
|
||
}
|
||
}
|