11//! Mirror structs for coordinator output types.
22//!
33//! Coordinator crates cannot be imported directly because they depend on `hdk`
4- //! which requires a WASM target. These lightweight mirror structs replicate
5- //! the serialisation shape so Sweettest can deserialize zome call responses.
4+ //! which requires a WASM target. Integrity crates cannot be linked together
5+ //! because each emits C-level `__num_entry_types` / `__num_link_types` symbols
6+ //! that conflict when multiple integrity crates are linked into one binary.
7+ //!
8+ //! These lightweight mirror structs replicate the serialisation shape so
9+ //! Sweettest can deserialize zome call responses without importing any
10+ //! integrity crate.
611
712use holochain:: prelude:: * ;
813use serde:: { Deserialize , Serialize } ;
914
15+ // ── Local enum mirrors ─────────────────────────────────────
16+
17+ /// Mirror of `ResourceState` from `zome_resource_integrity`.
18+ /// Variant names must match the serde serialisation of the real enum.
19+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize , Default ) ]
20+ pub enum ResourceState {
21+ #[ default]
22+ PendingValidation ,
23+ Active ,
24+ Maintenance ,
25+ Retired ,
26+ Reserved ,
27+ }
28+
29+ /// Mirror of `DeviceStatus` from `zome_person_integrity`.
30+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
31+ pub enum DeviceStatus {
32+ Active ,
33+ Inactive ,
34+ Revoked ,
35+ }
36+
37+ /// Mirror of `ParticipationClaimType` from `zome_gouvernance_integrity::ppr`.
38+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
39+ pub enum ParticipationClaimType {
40+ // Genesis Role - Network Entry
41+ ResourceCreation ,
42+ ResourceValidation ,
43+ // Core Usage Role - Custodianship
44+ CustodyTransfer ,
45+ CustodyAcceptance ,
46+ // Intermediate Roles - Specialized Services
47+ MaintenanceCommitmentAccepted ,
48+ MaintenanceFulfillmentCompleted ,
49+ StorageCommitmentAccepted ,
50+ StorageFulfillmentCompleted ,
51+ TransportCommitmentAccepted ,
52+ TransportFulfillmentCompleted ,
53+ GoodFaithTransfer ,
54+ // Network Governance
55+ DisputeResolutionParticipation ,
56+ ValidationActivity ,
57+ RuleCompliance ,
58+ // Resource End-of-Life Management
59+ EndOfLifeDeclaration ,
60+ EndOfLifeValidation ,
61+ }
62+
1063// ── Person zome mirrors ──────────────────────────────────────
1164
1265/// Mirror of `PersonProfileOutput` from `zome_person::person`.
@@ -17,8 +70,7 @@ pub struct PersonProfileOutput {
1770}
1871
1972/// Mirror of `Person` from `zome_person_integrity`.
20- /// We keep a separate mirror rather than importing the integrity crate directly
21- /// so that tests remain decoupled from integrity compilation quirks.
73+ /// Implements `TryFrom<SerializedBytes>` so it can be used with `Record::entry().to_app_option()`.
2274#[ derive( Debug , Clone , Serialize , Deserialize ) ]
2375pub struct PersonMirror {
2476 pub name : String ,
@@ -27,6 +79,7 @@ pub struct PersonMirror {
2779 #[ serde( default ) ]
2880 pub hrea_agent_hash : Option < ActionHash > ,
2981}
82+ holochain_serialized_bytes:: holochain_serial!( PersonMirror ) ;
3083
3184/// Mirror of `PrivatePersonData` from `zome_person_integrity`.
3285#[ derive( Debug , Clone , Serialize , Deserialize ) ]
@@ -63,6 +116,7 @@ pub struct GetPersonRolesOutput {
63116}
64117
65118/// Mirror of hREA `ReaAgent` for cross-DNA bridge tests.
119+ /// Implements `TryFrom<SerializedBytes>` so it can be used with `Record::entry().to_app_option()`.
66120#[ derive( Debug , Clone , Serialize , Deserialize ) ]
67121pub struct ReaAgentMirror {
68122 pub id : Option < ActionHash > ,
@@ -72,6 +126,7 @@ pub struct ReaAgentMirror {
72126 pub classified_as : Option < Vec < String > > ,
73127 pub note : Option < String > ,
74128}
129+ holochain_serialized_bytes:: holochain_serial!( ReaAgentMirror ) ;
75130
76131// ── Resource zome mirrors ────────────────────────────────────
77132
@@ -86,6 +141,26 @@ pub struct ResourceSpecMirror {
86141 pub is_active : bool ,
87142}
88143
144+ /// Mirror of `ResourceSpecification` from `zome_resource_integrity` (full entry shape).
145+ /// Used in `GetResourceSpecWithRulesOutput` mirrors that return the raw entry.
146+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
147+ pub struct ResourceSpecificationMirror {
148+ pub name : String ,
149+ pub description : String ,
150+ pub category : String ,
151+ pub image_url : Option < String > ,
152+ pub tags : Vec < String > ,
153+ pub is_active : bool ,
154+ }
155+
156+ /// Mirror of `GovernanceRule` from `zome_resource_integrity`.
157+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
158+ pub struct GovernanceRuleMirror {
159+ pub rule_type : String ,
160+ pub rule_data : String ,
161+ pub enforced_by : Option < String > ,
162+ }
163+
89164/// Mirror of `CreateResourceSpecificationOutput` from `zome_resource::resource_specification`.
90165#[ derive( Debug , Clone , Serialize , Deserialize ) ]
91166pub struct CreateResourceSpecOutput {
@@ -101,14 +176,13 @@ pub struct GetAllResourceSpecsOutput {
101176}
102177
103178/// Mirror of `EconomicResource` from `zome_resource_integrity`.
104- /// The `state` field is serialized as a string by the `ResourceState::Display` impl.
105179#[ derive( Debug , Clone , Serialize , Deserialize ) ]
106180pub struct EconomicResourceMirror {
107181 pub quantity : f64 ,
108182 pub unit : String ,
109183 pub custodian : AgentPubKey ,
110184 pub current_location : Option < String > ,
111- pub state : zome_resource_integrity :: ResourceState ,
185+ pub state : ResourceState ,
112186}
113187
114188/// Mirror of `CreateEconomicResourceOutput` from `zome_resource::economic_resource`.
@@ -127,49 +201,103 @@ pub struct GetAllEconomicResourcesOutput {
127201// ── Governance / Commitment / Event mirrors ──────────────────
128202
129203/// Mirror of `ProposeCommitmentOutput` from `zome_gouvernance::commitment`.
204+ /// The `commitment` field is left as opaque JSON since tests mostly need the hash.
130205#[ derive( Debug , Clone , Serialize , Deserialize ) ]
131206pub struct ProposeCommitmentOutput {
132207 pub commitment_hash : ActionHash ,
133- pub commitment : zome_gouvernance_integrity :: Commitment ,
208+ pub commitment : serde_json :: Value ,
134209}
135210
136211/// Mirror of `LogEconomicEventOutput` from `zome_gouvernance::economic_event`.
137212#[ derive( Debug , Clone , Serialize , Deserialize ) ]
138213pub struct LogEconomicEventOutput {
139214 pub event_hash : ActionHash ,
140- pub event : zome_gouvernance_integrity :: EconomicEvent ,
215+ pub event : serde_json :: Value ,
141216 pub ppr_claims : Option < IssueParticipationReceiptsOutputMirror > ,
142217}
143218
144219/// Mirror of `ClaimCommitmentOutput` from `zome_gouvernance::commitment`.
145220#[ derive( Debug , Clone , Serialize , Deserialize ) ]
146221pub struct ClaimCommitmentOutput {
147222 pub claim_hash : ActionHash ,
148- pub claim : zome_gouvernance_integrity :: Claim ,
223+ pub claim : serde_json :: Value ,
149224}
150225
151226// ── PPR (Private Participation Receipts) mirrors ─────────────
152227
228+ /// Mirror of `PerformanceMetrics` from `zome_gouvernance_integrity::ppr`.
229+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
230+ pub struct PerformanceMetricsMirror {
231+ pub timeliness : f64 ,
232+ pub quality : f64 ,
233+ pub reliability : f64 ,
234+ pub communication : f64 ,
235+ pub overall_satisfaction : f64 ,
236+ pub notes : Option < String > ,
237+ }
238+
239+ /// Mirror of `CryptographicSignature` from `zome_gouvernance_integrity::ppr`.
240+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
241+ pub struct CryptographicSignatureMirror {
242+ pub recipient_signature : Signature ,
243+ pub counterparty_signature : Signature ,
244+ pub signed_data_hash : [ u8 ; 32 ] ,
245+ pub signing_timestamp : Timestamp ,
246+ }
247+
248+ /// Mirror of `PrivateParticipationClaim` from `zome_gouvernance_integrity::ppr`.
249+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
250+ pub struct PrivateParticipationClaimMirror {
251+ // Standard ValueFlows fields
252+ pub fulfills : ActionHash ,
253+ pub fulfilled_by : ActionHash ,
254+ pub claimed_at : Timestamp ,
255+ // PPR-specific extensions
256+ pub claim_type : ParticipationClaimType ,
257+ pub performance_metrics : PerformanceMetricsMirror ,
258+ pub bilateral_signature : CryptographicSignatureMirror ,
259+ // Additional context
260+ pub counterparty : AgentPubKey ,
261+ pub resource_hash : Option < ActionHash > ,
262+ pub notes : Option < String > ,
263+ }
264+
153265/// Mirror of `IssueParticipationReceiptsOutput` from `zome_gouvernance::ppr`.
154266#[ derive( Debug , Clone , Serialize , Deserialize ) ]
155267pub struct IssueParticipationReceiptsOutputMirror {
156268 pub provider_claim_hash : ActionHash ,
157269 pub receiver_claim_hash : ActionHash ,
158- pub provider_claim : zome_gouvernance_integrity :: PrivateParticipationClaim ,
159- pub receiver_claim : zome_gouvernance_integrity :: PrivateParticipationClaim ,
270+ pub provider_claim : PrivateParticipationClaimMirror ,
271+ pub receiver_claim : PrivateParticipationClaimMirror ,
160272}
161273
162274/// Mirror of `GetMyParticipationClaimsOutput` from `zome_gouvernance::ppr`.
163275#[ derive( Debug , Clone , Serialize , Deserialize ) ]
164276pub struct GetMyParticipationClaimsOutput {
165- pub claims : Vec < ( ActionHash , zome_gouvernance_integrity :: PrivateParticipationClaim ) > ,
277+ pub claims : Vec < ( ActionHash , PrivateParticipationClaimMirror ) > ,
166278 pub total_count : u32 ,
167279}
168280
281+ /// Mirror of `ReputationSummary` from `zome_gouvernance_integrity::ppr`.
282+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
283+ pub struct ReputationSummaryMirror {
284+ pub total_claims : u32 ,
285+ pub average_performance : f64 ,
286+ pub creation_claims : u32 ,
287+ pub custody_claims : u32 ,
288+ pub service_claims : u32 ,
289+ pub governance_claims : u32 ,
290+ pub end_of_life_claims : u32 ,
291+ pub period_start : Timestamp ,
292+ pub period_end : Timestamp ,
293+ pub agent : AgentPubKey ,
294+ pub generated_at : Timestamp ,
295+ }
296+
169297/// Mirror of `DeriveReputationSummaryOutput` from `zome_gouvernance::ppr`.
170298#[ derive( Debug , Clone , Serialize , Deserialize ) ]
171299pub struct DeriveReputationSummaryOutput {
172- pub summary : zome_gouvernance_integrity :: ReputationSummary ,
300+ pub summary : ReputationSummaryMirror ,
173301 pub claims_included : u32 ,
174302}
175303
@@ -213,5 +341,5 @@ pub struct DeviceMirror {
213341 pub owner_person : ActionHash ,
214342 pub registered_at : Timestamp ,
215343 pub last_active : Timestamp ,
216- pub status : zome_person_integrity :: DeviceStatus ,
344+ pub status : DeviceStatus ,
217345}
0 commit comments