1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//! Rights mechanic - Legal claim and ownership management.
//!
//! This module provides a policy-based rights system for managing
//! legal claims and ownership rights to assets. It focuses on **who has
//! legal rights to what**, not on physical possession (which is handled
//! by the Inventory mechanic).
//!
//! # Core Concept
//!
//! The rights mechanic models **legal claims and ownership**:
//! - Asserting claims to assets
//! - Transferring rights between entities
//! - Recognition and legitimacy
//! - Temporal rights (leases, temporary ownership)
//!
//! # Policy Dimensions
//!
//! The rights mechanic composes three orthogonal policies:
//!
//! 1. **RightsSystemPolicy**: How claims are structured
//! - `AbsoluteRights`: 100% or nothing (modern property)
//! - `PartialRights`: 0-100% fractional ownership (stocks)
//! - `LayeredRights`: Overlapping claims (feudal systems)
//!
//! 2. **TransferPolicy**: How claims can be transferred
//! - `FreeTransfer`: Unrestricted transfer
//! - `RestrictedTransfer`: Requires recognition or meets conditions
//! - `NonTransferable`: Cannot be transferred (personal rights)
//!
//! 3. **RecognitionPolicy**: How claims are validated
//! - `SelfRecognition`: No external validation needed
//! - `AuthorityRecognition`: Requires authority approval
//! - `ConsensusRecognition`: Legitimacy scales with recognition count
//!
//! # Examples
//!
//! ## Modern Property Ownership
//!
//! ```
//! use issun_core::mechanics::rights::prelude::*;
//! use issun_core::mechanics::{Mechanic, EventEmitter};
//!
//! // Define rights type
//! type Property = RightsMechanic<
//! AbsoluteRights,
//! FreeTransfer,
//! SelfRecognition,
//! >;
//!
//! // Or use preset
//! type Property2 = ModernPropertyRights;
//!
//! // Configure
//! let config = RightsConfig::default();
//!
//! // Create state
//! let mut state = RightsState::new();
//!
//! // Assert claim
//! # struct TestEmitter;
//! # impl EventEmitter<RightsEvent> for TestEmitter {
//! # fn emit(&mut self, _event: RightsEvent) {}
//! # }
//! let mut emitter = TestEmitter;
//! let input = RightsInput {
//! action: RightsAction::AssertClaim {
//! asset_id: 42,
//! strength: 1.0,
//! expiration: None,
//! },
//! elapsed_time: 0,
//! };
//!
//! Property::step(&config, &mut state, input, &mut emitter);
//! ```
//!
//! ## Stock Ownership (Partial Rights)
//!
//! ```
//! use issun_core::mechanics::rights::prelude::*;
//!
//! type Stocks = StockOwnership;
//!
//! let config = RightsConfig {
//! allow_partial_claims: true,
//! ..Default::default()
//! };
//! ```
//!
//! ## Feudal Land System
//!
//! ```
//! use issun_core::mechanics::rights::prelude::*;
//!
//! type FeudalLand = FeudalRights;
//!
//! let config = RightsConfig {
//! allow_partial_claims: true,
//! require_recognition: true,
//! legitimacy_decay_rate: 0.05, // Unrecognized claims decay
//! ..Default::default()
//! };
//! ```
//!
//! # Design Philosophy
//!
//! ## Separation from Physical Possession
//!
//! Rights and Inventory are **complementary but independent**:
//!
//! | Mechanic | Handles | Example |
//! |----------|---------|---------|
//! | **Inventory** | Physical possession | "I hold the sword" |
//! | **Rights** | Legal ownership | "I own the sword" |
//!
//! This allows modeling:
//! - **Theft**: Inventory without Rights
//! - **Stored goods**: Rights without Inventory
//! - **Contested ownership**: Multiple Rights claims to same asset
//!
//! ## Integration with Other Mechanics
//!
//! - **Diplomacy**: External recognition affects legitimacy
//! - **Faction**: Group claims to assets
//! - **Territory**: Special case of spatial rights
//! - **Market**: Rights determine who can trade
//!
//! ## Temporal Rights
//!
//! Rights can have expiration times, enabling:
//! - Leases and rentals
//! - Temporary licenses
//! - Time-limited contracts
//!
//! # Asset Identification
//!
//! Assets are identified by `AssetId` (u64). This is intentionally generic:
//! - Can reference inventory items
//! - Can reference territory parcels
//! - Can reference abstract concepts (titles, privileges)
//!
//! In Bevy integration, you may want to implement conversion traits
//! (Into<String>, From<String>) if string-based IDs are needed.
// Re-export core types at module level
pub use RightsMechanic;
pub use ;