Skip to main content

ic_query/nns/proposals/report/model/
reports.rs

1//! Module: nns::proposals::report::model::reports
2//!
3//! Responsibility: serialized NNS proposal report and row DTOs.
4//! Does not own: request selection, source transport, or text rendering.
5//! Boundary: defines the stable JSON contract for NNS proposal output.
6
7use serde::{Deserialize, Serialize};
8
9///
10/// NnsProposalListReport
11///
12/// Serializable report for a bounded NNS governance proposal listing.
13///
14
15#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
16pub struct NnsProposalListReport {
17    pub schema_version: u32,
18    pub network: String,
19    pub governance_canister_id: String,
20    pub fetched_at: String,
21    pub source_endpoint: String,
22    pub fetched_by: String,
23    pub data_source: String,
24    pub cache_path: Option<String>,
25    pub cache_complete: Option<bool>,
26    pub requested_limit: u32,
27    pub before_proposal_id: Option<u64>,
28    pub status_filter: String,
29    pub reward_status_filter: String,
30    pub topic_filter: String,
31    pub proposer_filter: Option<u64>,
32    pub query_filter: Option<String>,
33    pub sort: String,
34    pub sort_direction: String,
35    pub result_scope: String,
36    pub verbose: bool,
37    pub proposal_count: usize,
38    pub proposals: Vec<NnsProposalRow>,
39}
40
41///
42/// NnsProposalReport
43///
44/// Serializable report for one NNS governance proposal detail lookup.
45///
46
47#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
48pub struct NnsProposalReport {
49    pub schema_version: u32,
50    pub network: String,
51    pub governance_canister_id: String,
52    pub fetched_at: String,
53    pub source_endpoint: String,
54    pub fetched_by: String,
55    pub data_source: String,
56    pub cache_path: Option<String>,
57    pub cache_complete: Option<bool>,
58    pub proposal_id: u64,
59    pub show_ballots: bool,
60    pub verbose: bool,
61    pub proposal: NnsProposalRow,
62}
63
64///
65/// NnsProposalRow
66///
67/// Serializable row for one NNS governance proposal.
68///
69
70#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
71pub struct NnsProposalRow {
72    pub proposal_id: Option<u64>,
73    pub proposer_neuron_id: Option<u64>,
74    pub topic: i32,
75    pub topic_text: String,
76    pub status: i32,
77    pub status_text: String,
78    pub reward_status: i32,
79    pub reward_status_text: String,
80    pub title: Option<String>,
81    pub summary: String,
82    pub url: String,
83    pub action_text: Option<String>,
84    pub reject_cost_e8s: u64,
85    pub proposal_timestamp_seconds: u64,
86    pub proposed_at: String,
87    pub deadline_timestamp_seconds: Option<u64>,
88    pub deadline_at: Option<String>,
89    pub decided_timestamp_seconds: u64,
90    pub decided_at: Option<String>,
91    pub executed_timestamp_seconds: u64,
92    pub executed_at: Option<String>,
93    pub failed_timestamp_seconds: u64,
94    pub failed_at: Option<String>,
95    pub reward_event_round: u64,
96    pub total_potential_voting_power: Option<u64>,
97    pub latest_tally: Option<NnsProposalTally>,
98    pub ballot_count: usize,
99    pub ballots: Vec<NnsProposalBallotRow>,
100}
101
102///
103/// NnsProposalBallotRow
104///
105/// Serializable NNS proposal ballot row.
106///
107
108#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
109pub struct NnsProposalBallotRow {
110    pub neuron_id: u64,
111    pub vote: i32,
112    pub vote_text: String,
113    pub voting_power: u64,
114}
115
116///
117/// NnsProposalTally
118///
119/// Serializable NNS proposal vote tally.
120///
121
122#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
123pub struct NnsProposalTally {
124    pub timestamp_seconds: u64,
125    pub yes: u64,
126    pub no: u64,
127    pub total: u64,
128}