Skip to main content

ic_query/ic/model/
reports.rs

1//! Module: ic::model::reports
2//!
3//! Responsibility: public serialized Dashboard report, row, and provenance contracts.
4//! Does not own: requests, host source data, errors, transport, or projection.
5//! Boundary: preserves raw Dashboard values and explicit off-chain provenance.
6
7use super::requests::{
8    IcCanisterFilters, IcDailyStatsQuery, IcIcrcAccountListQuery, IcIcrcHolderListQuery,
9    IcIcrcIndexedCountKind, IcIcrcTokenValueQuery, IcIcrcTotalSupplyQuery, IcMetricQuery,
10    IcNodeProviderRewardHistoryQuery, IcNodeProviderRewardListQuery, IcReplicaVersionListQuery,
11};
12use serde::Serialize;
13use std::{collections::BTreeMap, fmt};
14
15///
16/// IcCanisterUpgrade
17///
18/// One proposal-linked canister upgrade recorded by the Dashboard API.
19///
20
21#[derive(Clone, Debug, Eq, PartialEq, Serialize, serde::Deserialize)]
22pub struct IcCanisterUpgrade {
23    /// Proposal execution time as raw Unix seconds.
24    pub executed_timestamp_seconds: u64,
25    /// Wasm module hash as raw lowercase hexadecimal text.
26    pub module_hash: String,
27    /// NNS proposal that installed this module.
28    pub proposal_id: u64,
29}
30
31///
32/// IcDashboardReportProvenance
33///
34/// Shared off-chain provenance and authority guarantees for Dashboard reports.
35///
36
37#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
38pub struct IcDashboardReportProvenance {
39    /// Report schema version.
40    pub schema_version: u32,
41    /// Network represented by the official Dashboard API.
42    pub network: String,
43    /// Authority that supplied the report fields.
44    pub authority: String,
45    /// Dashboard API base endpoint queried by the source.
46    pub source_endpoint: String,
47    /// Time this report was collected.
48    pub fetched_at: String,
49    /// Collector identity.
50    pub fetched_by: String,
51    /// Whether the API response is cryptographically certified IC state.
52    pub certified: bool,
53    /// Whether every returned value is guaranteed to describe one point in time.
54    pub point_in_time_guaranteed: bool,
55}
56
57///
58/// IcMetricObservation
59///
60/// One raw timestamp and value returned by the Dashboard Metrics API.
61///
62
63#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
64pub struct IcMetricObservation {
65    /// Observation timestamp as Unix seconds.
66    pub timestamp_unix_secs: u64,
67    /// Raw value string returned by the Dashboard.
68    pub value: String,
69}
70
71///
72/// IcMetricSeries
73///
74/// One named raw series in a Dashboard metric response.
75///
76
77#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
78pub struct IcMetricSeries {
79    /// Raw Dashboard response field that names this series.
80    pub name: String,
81    /// Observations in strictly increasing timestamp order.
82    pub observations: Vec<IcMetricObservation>,
83}
84
85///
86/// IcMetricReport
87///
88/// One bounded time-series response from the official Dashboard Metrics API.
89///
90
91#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
92pub struct IcMetricReport {
93    /// Shared Dashboard provenance, flattened in serialized report JSON.
94    #[serde(flatten)]
95    pub provenance: IcDashboardReportProvenance,
96    /// Metric and explicit time-series bounds, flattened in report JSON.
97    #[serde(flatten)]
98    pub query: IcMetricQuery,
99    /// Raw named time series in canonical series-name order.
100    pub series: Vec<IcMetricSeries>,
101}
102
103///
104/// IcIcrcTotalSupplyObservation
105///
106/// One raw ICRC ledger total-supply observation returned by the Dashboard API.
107///
108
109#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
110pub struct IcIcrcTotalSupplyObservation {
111    /// Observation timestamp as Unix seconds.
112    pub timestamp_unix_secs: u64,
113    /// Raw total supply in ledger base units.
114    pub total_supply_base_units: String,
115}
116
117///
118/// IcIcrcTotalSupplyReport
119///
120/// One bounded total-supply series from the official Dashboard ICRC API.
121///
122
123#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
124pub struct IcIcrcTotalSupplyReport {
125    /// Shared Dashboard provenance, flattened in serialized report JSON.
126    #[serde(flatten)]
127    pub provenance: IcDashboardReportProvenance,
128    /// Canonical ICRC ledger canister principal requested from the API.
129    pub ledger_canister_id: String,
130    /// Exact requested time bounds, flattened in report JSON.
131    #[serde(flatten)]
132    pub query: IcIcrcTotalSupplyQuery,
133    /// Maximum observations implied by the requested inclusive window.
134    pub requested_observation_limit: u64,
135    /// Raw observations in strictly increasing timestamp order.
136    pub observations: Vec<IcIcrcTotalSupplyObservation>,
137}
138
139///
140/// IcIcrcIndexedCountReport
141///
142/// One current scalar count from the official Dashboard ICRC index.
143///
144
145#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
146pub struct IcIcrcIndexedCountReport {
147    /// Shared Dashboard provenance, flattened in serialized report JSON.
148    #[serde(flatten)]
149    pub provenance: IcDashboardReportProvenance,
150    /// Canonical ICRC ledger canister principal requested from the API.
151    pub ledger_canister_id: String,
152    /// Indexed resource represented by this count.
153    pub kind: IcIcrcIndexedCountKind,
154    /// Number of matching resources currently represented by the Dashboard index.
155    pub total: u64,
156}
157
158///
159/// IcIcrcAccountRow
160///
161/// One account record maintained by the official ICRC index.
162///
163
164#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
165pub struct IcIcrcAccountRow {
166    /// Opaque stable account id used for exact API follow-up.
167    pub account_id: String,
168    /// Canonical account owner principal.
169    pub owner: String,
170    /// Raw subaccount text returned by the API; empty denotes the default subaccount.
171    pub subaccount: String,
172    /// Raw current indexed balance in ledger base units.
173    pub balance_base_units: String,
174    /// Number of indexed transactions involving this account.
175    pub total_transactions: u64,
176    /// Account creation timestamp normalized to Unix seconds.
177    pub created_at_unix_secs: u64,
178    /// Nanoseconds below the normalized creation second, preserving upstream precision.
179    pub created_at_subsec_nanos: u32,
180    /// Canonical ledger canister principal carried by the row.
181    pub ledger_canister_id: String,
182    /// Latest indexed transaction involving this account.
183    pub latest_transaction_index: u64,
184    /// Raw Dashboard database update timestamp.
185    pub dashboard_updated_at: String,
186    /// Whether the account is currently classified as an active fee collector.
187    pub active_fee_collector: bool,
188    /// Raw fee-collector block-range arrays returned by the Dashboard.
189    pub fee_collector_block_ranges: Vec<Vec<serde_json::Value>>,
190}
191
192///
193/// IcIcrcAccountListReport
194///
195/// One explicitly bounded account-index page from the official ICRC API.
196///
197
198#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
199pub struct IcIcrcAccountListReport {
200    /// Shared Dashboard provenance, flattened in serialized report JSON.
201    #[serde(flatten)]
202    pub provenance: IcDashboardReportProvenance,
203    /// Canonical ICRC ledger canister principal requested from the API.
204    pub ledger_canister_id: String,
205    /// Exact page query, flattened in report JSON.
206    #[serde(flatten)]
207    pub query: IcIcrcAccountListQuery,
208    /// Opaque cursor for an explicit preceding-page request.
209    pub previous_cursor: Option<String>,
210    /// Opaque cursor for an explicit following-page request.
211    pub next_cursor: Option<String>,
212    /// Account rows in the exact order returned by the API.
213    pub rows: Vec<IcIcrcAccountRow>,
214}
215
216///
217/// IcIcrcAccountInfoReport
218///
219/// One exact account record from the official ICRC API.
220///
221
222#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
223pub struct IcIcrcAccountInfoReport {
224    /// Shared Dashboard provenance, flattened in serialized report JSON.
225    #[serde(flatten)]
226    pub provenance: IcDashboardReportProvenance,
227    /// Exact account record, flattened in serialized report JSON.
228    #[serde(flatten)]
229    pub account: IcIcrcAccountRow,
230}
231
232///
233/// IcIcrcHolderRow
234///
235/// One principal-level holder aggregate maintained by the official ICRC index.
236///
237
238#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
239pub struct IcIcrcHolderRow {
240    /// Canonical holder principal.
241    pub principal: String,
242    /// Raw aggregate balance in ledger base units.
243    pub balance_base_units: String,
244    /// Number of indexed transactions across the holder's accounts.
245    pub total_transactions: u64,
246    /// Earliest indexed account creation timestamp normalized to Unix seconds.
247    pub created_at_unix_secs: u64,
248    /// Nanoseconds below the normalized creation second, preserving upstream precision.
249    pub created_at_subsec_nanos: u32,
250    /// Canonical ledger canister principal carried by the row.
251    pub ledger_canister_id: String,
252    /// Latest indexed transaction across the holder's accounts.
253    pub latest_transaction_index: u64,
254    /// Raw numeric supply percentage returned by the Dashboard.
255    pub percentage: serde_json::Value,
256    /// Raw nullable USD value returned by the Dashboard.
257    pub value_usd: serde_json::Value,
258    /// Raw Dashboard database update timestamp.
259    pub dashboard_updated_at: String,
260}
261
262///
263/// IcIcrcHolderListReport
264///
265/// One explicitly bounded holder-index page from the official ICRC API.
266///
267
268#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
269pub struct IcIcrcHolderListReport {
270    /// Shared Dashboard provenance, flattened in serialized report JSON.
271    #[serde(flatten)]
272    pub provenance: IcDashboardReportProvenance,
273    /// Canonical ICRC ledger canister principal requested from the API.
274    pub ledger_canister_id: String,
275    /// Exact page query, flattened in report JSON.
276    #[serde(flatten)]
277    pub query: IcIcrcHolderListQuery,
278    /// Opaque cursor for an explicit preceding-page request.
279    pub previous_cursor: Option<String>,
280    /// Opaque cursor for an explicit following-page request.
281    pub next_cursor: Option<String>,
282    /// Holder rows in the exact order returned by the API.
283    pub rows: Vec<IcIcrcHolderRow>,
284}
285
286///
287/// IcIcrcTokenValueRow
288///
289/// One raw externally sourced token-value record returned by the Dashboard API.
290///
291
292#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
293pub struct IcIcrcTokenValueRow {
294    /// Raw legacy price field in USD, when returned.
295    pub price: Option<String>,
296    /// Raw legacy 24-hour volume field in USD, when returned.
297    pub volume_24h: Option<String>,
298    /// Raw explicit price-in-USD field, when returned.
299    pub price_usd: Option<String>,
300    /// Raw explicit 24-hour volume-in-USD field, when returned.
301    pub volume_24h_usd: Option<String>,
302    /// External value provider named by the Dashboard, when returned.
303    pub source: Option<String>,
304    /// External value-provider URL returned by the Dashboard, when present.
305    pub source_url: Option<String>,
306    /// Observation timestamp as Unix seconds.
307    pub timestamp_unix_secs: u64,
308}
309
310///
311/// IcIcrcTokenValueReport
312///
313/// One bounded token-value series from the official Dashboard ICRC API.
314///
315
316#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
317pub struct IcIcrcTokenValueReport {
318    /// Shared Dashboard provenance, flattened in serialized report JSON.
319    #[serde(flatten)]
320    pub provenance: IcDashboardReportProvenance,
321    /// Canonical ICRC ledger canister principal requested from the API.
322    pub ledger_canister_id: String,
323    /// Exact requested time and row bounds, flattened in report JSON.
324    #[serde(flatten)]
325    pub query: IcIcrcTokenValueQuery,
326    /// Whether the response reached the requested limit and may be truncated.
327    pub limit_reached: bool,
328    /// Raw token-value rows in nondecreasing timestamp order.
329    pub rows: Vec<IcIcrcTokenValueRow>,
330}
331
332///
333/// IcDailyStatsRow
334///
335/// Selected raw daily network-activity values returned by the Dashboard API.
336///
337
338#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, Serialize)]
339pub struct IcDailyStatsRow {
340    /// Raw UTC calendar day returned by the Dashboard.
341    pub day: String,
342    /// Observation timestamp as Unix seconds.
343    #[serde(rename(deserialize = "timestamp"))]
344    pub timestamp_unix_secs: u64,
345    /// Raw average query-transaction rate.
346    pub average_query_transactions_per_second: String,
347    /// Raw average update-transaction rate.
348    pub average_update_transactions_per_second: String,
349    /// Raw average total-transaction rate.
350    pub average_transactions_per_second: String,
351    /// Raw maximum query-transaction rate.
352    pub max_query_transactions_per_second: String,
353    /// Raw maximum update-transaction rate.
354    pub max_update_transactions_per_second: String,
355    /// Raw maximum total-transaction rate.
356    pub max_total_transactions_per_second: String,
357    /// Raw average block-production rate.
358    pub blocks_per_second_average: String,
359}
360
361///
362/// IcDailyStatsReport
363///
364/// One bounded daily network-activity response from the official Dashboard API.
365///
366
367#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
368pub struct IcDailyStatsReport {
369    /// Shared Dashboard provenance, flattened in serialized report JSON.
370    #[serde(flatten)]
371    pub provenance: IcDashboardReportProvenance,
372    /// Exact requested time bounds, flattened in report JSON.
373    #[serde(flatten)]
374    pub query: IcDailyStatsQuery,
375    /// Rows in strictly increasing timestamp order.
376    pub rows: Vec<IcDailyStatsRow>,
377}
378
379///
380/// IcBoundaryNodeDataCenterRow
381///
382/// One raw data-center aggregate returned by the boundary-node API.
383///
384
385#[derive(Clone, Debug, Eq, PartialEq, Serialize, serde::Deserialize)]
386pub struct IcBoundaryNodeDataCenterRow {
387    /// Dashboard data-center identifier.
388    pub dc_id: String,
389    /// Raw data-center display name.
390    pub name: String,
391    /// Raw infrastructure-owner label.
392    pub owner: String,
393    /// Raw Dashboard region label.
394    pub region: String,
395    /// Raw decimal latitude.
396    pub latitude: String,
397    /// Raw decimal longitude.
398    pub longitude: String,
399    /// Raw decimal count of boundary nodes assigned to this data center.
400    pub total_nodes: String,
401}
402
403///
404/// IcBoundaryNodeDataCentersReport
405///
406/// One complete response from the official boundary-node data-center resource.
407///
408
409#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
410pub struct IcBoundaryNodeDataCentersReport {
411    /// Shared Dashboard provenance, flattened in serialized report JSON.
412    #[serde(flatten)]
413    pub provenance: IcDashboardReportProvenance,
414    /// Sum of the raw per-data-center boundary-node counts.
415    pub total_node_count: u64,
416    /// Rows in canonical data-center-id order, including zero-node locations.
417    pub rows: Vec<IcBoundaryNodeDataCenterRow>,
418}
419
420///
421/// IcNodeProviderRewardXdrConversionRate
422///
423/// XDR conversion-rate evidence recorded with one node-provider reward.
424///
425
426#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
427pub struct IcNodeProviderRewardXdrConversionRate {
428    /// Conversion-rate timestamp as Unix seconds, when present in the record.
429    #[serde(skip_serializing_if = "Option::is_none")]
430    pub timestamp_unix_secs: Option<u64>,
431    /// XDR per ICP multiplied by 10,000, when present in the record.
432    #[serde(skip_serializing_if = "Option::is_none")]
433    pub xdr_permyriad_per_icp: Option<u64>,
434}
435
436///
437/// IcNodeProviderRewardRow
438///
439/// One raw node-provider reward record returned by the official Dashboard API.
440///
441
442#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
443pub struct IcNodeProviderRewardRow {
444    /// Dashboard reward record id.
445    pub reward_id: u64,
446    /// Reward amount in raw ICP e8s.
447    pub amount_e8s: u64,
448    /// Mode-specific raw reward details preserved as a JSON object.
449    pub details: BTreeMap<String, serde_json::Value>,
450    /// Maximum node-provider reward in e8s used for this record, when available.
451    pub maximum_node_provider_rewards_e8s: Option<u64>,
452    /// Minimum XDR-permyriad-per-ICP floor used for this record, when available.
453    pub minimum_xdr_permyriad_per_icp: Option<u64>,
454    /// Canonical node-provider principal.
455    pub node_provider_id: String,
456    /// NNS proposal associated with this reward, when recorded by the Dashboard.
457    pub proposal_id: Option<u64>,
458    /// Registry version associated with this reward, when recorded by the Dashboard.
459    pub registry_version: Option<u64>,
460    /// Raw mode name so additive Dashboard reward modes remain visible.
461    pub reward_mode: String,
462    /// Reward timestamp as Unix seconds.
463    pub reward_timestamp_unix_secs: u64,
464    /// Raw Dashboard database update timestamp.
465    pub dashboard_updated_at: String,
466    /// XDR conversion-rate evidence, empty for historical records that predate it.
467    pub xdr_conversion_rate: IcNodeProviderRewardXdrConversionRate,
468}
469
470///
471/// IcNodeProviderRewardListReport
472///
473/// One explicitly bounded node-provider reward page from the official Dashboard API.
474///
475
476#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
477pub struct IcNodeProviderRewardListReport {
478    /// Shared Dashboard provenance, flattened in serialized report JSON.
479    #[serde(flatten)]
480    pub provenance: IcDashboardReportProvenance,
481    /// Exact requested page bounds, flattened in report JSON.
482    #[serde(flatten)]
483    pub query: IcNodeProviderRewardListQuery,
484    /// Reward-index ceiling selected by the Dashboard for this page series.
485    pub resolved_max_reward_index: u64,
486    /// Number of reward records matching the selected reward-index ceiling.
487    pub total_reward_records: u64,
488    /// Arithmetic offset hint for an explicit later request, when more records remain.
489    pub next_offset_hint: Option<u64>,
490    /// Whether adjacent upstream offset pages can contain overlapping record ids.
491    pub pages_may_overlap: bool,
492    /// Reward rows in the exact order returned by the Dashboard.
493    pub rows: Vec<IcNodeProviderRewardRow>,
494}
495
496///
497/// IcNodeProviderRewardInfoReport
498///
499/// One exact node-provider reward record from the official Dashboard API.
500///
501
502#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
503pub struct IcNodeProviderRewardInfoReport {
504    /// Shared Dashboard provenance, flattened in serialized report JSON.
505    #[serde(flatten)]
506    pub provenance: IcDashboardReportProvenance,
507    /// Exact reward record, flattened in serialized report JSON.
508    #[serde(flatten)]
509    pub reward: IcNodeProviderRewardRow,
510}
511
512///
513/// IcNodeProviderRewardHistoryObservation
514///
515/// One aggregate reward amount returned by the Dashboard history endpoint.
516///
517
518#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
519pub struct IcNodeProviderRewardHistoryObservation {
520    /// Observation timestamp as Unix seconds.
521    pub timestamp_unix_secs: u64,
522    /// Aggregate node-provider reward amount in raw ICP e8s.
523    pub amount_e8s: u64,
524}
525
526///
527/// IcNodeProviderRewardHistoryReport
528///
529/// One bounded aggregate node-provider reward history response.
530///
531
532#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
533pub struct IcNodeProviderRewardHistoryReport {
534    /// Shared Dashboard provenance, flattened in serialized report JSON.
535    #[serde(flatten)]
536    pub provenance: IcDashboardReportProvenance,
537    /// Exact requested history bounds, flattened in report JSON.
538    #[serde(flatten)]
539    pub query: IcNodeProviderRewardHistoryQuery,
540    /// Maximum observations implied by the requested inclusive window.
541    pub requested_observation_limit: u64,
542    /// Aggregate observations in strictly increasing timestamp order.
543    pub observations: Vec<IcNodeProviderRewardHistoryObservation>,
544}
545
546///
547/// IcReplicaVersionStatus
548///
549/// Raw lifecycle status exposed by the official Dashboard release index.
550///
551
552#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize)]
553#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
554pub enum IcReplicaVersionStatus {
555    /// The election proposal has been adopted but not executed.
556    Adopted,
557    /// The election proposal has executed.
558    Executed,
559    /// The election proposal remains open.
560    Open,
561}
562
563impl IcReplicaVersionStatus {
564    /// Return the exact official Dashboard query value.
565    #[must_use]
566    pub const fn as_dashboard_value(self) -> &'static str {
567        match self {
568            Self::Adopted => "ADOPTED",
569            Self::Executed => "EXECUTED",
570            Self::Open => "OPEN",
571        }
572    }
573}
574
575impl fmt::Display for IcReplicaVersionStatus {
576    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
577        formatter.write_str(self.as_dashboard_value())
578    }
579}
580
581///
582/// IcReplicaVersionSubnetRollout
583///
584/// One Dashboard-recorded proposal assigning a Subnet to a replica version.
585///
586
587#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, Serialize)]
588pub struct IcReplicaVersionSubnetRollout {
589    /// Canonical Subnet principal.
590    pub subnet_id: String,
591    /// NNS proposal that assigned the Subnet to this version.
592    pub proposal_id: u64,
593    /// Proposal execution time as raw Unix seconds.
594    pub executed_timestamp_seconds: u64,
595}
596
597///
598/// IcReplicaVersionListRow
599///
600/// One release-election row from a bounded official Dashboard page.
601///
602
603#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
604pub struct IcReplicaVersionListRow {
605    /// Lowercase hexadecimal replica-version identifier.
606    pub replica_version_id: String,
607    /// NNS proposal that elected this version.
608    pub proposal_id: u64,
609    /// Election proposal execution time, or zero before execution.
610    pub executed_timestamp_seconds: u64,
611    /// Raw Dashboard proposal lifecycle status.
612    pub status: IcReplicaVersionStatus,
613    /// Raw proposal title.
614    pub title: String,
615    /// Raw proposal discussion URL.
616    pub url: String,
617    /// Dashboard-recorded Subnet assignments in execution order.
618    pub subnets: Vec<IcReplicaVersionSubnetRollout>,
619}
620
621///
622/// IcReplicaVersionListReport
623///
624/// One explicitly bounded replica-version page from the official Dashboard API.
625///
626
627#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
628pub struct IcReplicaVersionListReport {
629    /// Shared Dashboard provenance, flattened in serialized report JSON.
630    #[serde(flatten)]
631    pub provenance: IcDashboardReportProvenance,
632    /// Exact requested page bounds, flattened in report JSON.
633    #[serde(flatten)]
634    pub query: IcReplicaVersionListQuery,
635    /// Proposal-index ceiling selected by the Dashboard for this page series.
636    pub resolved_max_proposal_index: u64,
637    /// Number of release records matching the selected proposal-index ceiling.
638    pub total_proposals: u64,
639    /// Offset for an explicit next-page request, when more rows remain.
640    pub next_offset: Option<u64>,
641    /// Release rows in the Dashboard's requested descending execution-time order.
642    pub rows: Vec<IcReplicaVersionListRow>,
643}
644
645///
646/// IcReplicaVersionDetails
647///
648/// Exact Dashboard release-election payload shared by sources and reports.
649///
650
651#[derive(Clone, Debug, Eq, PartialEq, Serialize, serde::Deserialize)]
652pub struct IcReplicaVersionDetails {
653    /// Lowercase hexadecimal replica-version identifier.
654    pub replica_version_id: String,
655    /// NNS proposal that elected this version.
656    pub proposal_id: u64,
657    /// Election proposal execution time as raw Unix seconds.
658    pub executed_timestamp_seconds: u64,
659    /// Raw proposal title.
660    pub title: String,
661    /// Raw proposal discussion URL.
662    pub url: String,
663    /// Raw release-note summary.
664    pub summary: String,
665    /// Dashboard-recorded Subnet assignments in execution order.
666    pub subnets: Vec<IcReplicaVersionSubnetRollout>,
667}
668
669///
670/// IcReplicaVersionInfoReport
671///
672/// One exact replica-version release record from the official Dashboard API.
673///
674
675#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
676pub struct IcReplicaVersionInfoReport {
677    /// Shared Dashboard provenance, flattened in serialized report JSON.
678    #[serde(flatten)]
679    pub provenance: IcDashboardReportProvenance,
680    /// Shared record, flattened in serialized output.
681    #[serde(flatten)]
682    pub release: IcReplicaVersionDetails,
683}
684
685///
686/// IcCanisterData
687///
688/// Dashboard canister payload shared by source data and validated reports.
689/// Source values are validated and canonically ordered before publication.
690///
691
692#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
693pub struct IcCanisterData {
694    /// Canonical canister principal.
695    pub canister_id: String,
696    /// Dashboard database row identifier.
697    pub dashboard_id: u64,
698    /// Raw optional Dashboard canister classification.
699    pub canister_type: Option<String>,
700    /// Raw Dashboard canister name; an empty string means no name was recorded.
701    pub name: String,
702    /// Canonical Subnet principal recorded by the Dashboard.
703    pub subnet_id: String,
704    /// Canonically ordered controller principals recorded by the Dashboard.
705    pub controllers: Vec<String>,
706    /// Raw Dashboard language label; an empty string means no language was recorded.
707    pub language: String,
708    /// Raw current module hash; an empty string means no hash was recorded.
709    pub module_hash: String,
710    /// Raw Dashboard row update timestamp.
711    pub dashboard_updated_at: String,
712    /// Proposal-linked upgrade history, or `None` when the Dashboard returned `null`.
713    pub upgrades: Option<Vec<IcCanisterUpgrade>>,
714}
715
716///
717/// IcCanisterReport
718///
719/// One live canister metadata report from the official Dashboard API.
720///
721
722#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
723pub struct IcCanisterReport {
724    /// Shared Dashboard provenance, flattened in serialized report JSON.
725    #[serde(flatten)]
726    pub provenance: IcDashboardReportProvenance,
727    /// Canister payload, flattened in serialized report JSON.
728    #[serde(flatten)]
729    pub data: IcCanisterData,
730}
731
732///
733/// IcCanisterCountReport
734///
735/// One filtered canister count from the official Dashboard API.
736///
737
738#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
739pub struct IcCanisterCountReport {
740    /// Shared Dashboard provenance, flattened in serialized report JSON.
741    #[serde(flatten)]
742    pub provenance: IcDashboardReportProvenance,
743    /// Filters applied by the Dashboard.
744    pub filters: IcCanisterFilters,
745    /// Number of matching Dashboard canister records.
746    pub total: u64,
747}
748
749///
750/// IcCanisterPageController
751///
752/// One controller entry returned by the Dashboard canister collection API.
753///
754
755#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
756pub struct IcCanisterPageController {
757    /// Canonical controller principal.
758    pub principal_id: String,
759    /// Raw optional Dashboard metadata associated with the controller.
760    pub raw_metadata: Option<String>,
761}
762
763///
764/// IcCanisterPageRow
765///
766/// One discovery row from a bounded Dashboard canister page.
767///
768
769#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
770pub struct IcCanisterPageRow {
771    /// Canonical canister principal.
772    pub canister_id: String,
773    /// Dashboard database row identifier.
774    pub dashboard_id: u64,
775    /// Raw optional Dashboard canister classification.
776    pub canister_type: Option<String>,
777    /// Raw Dashboard canister name.
778    pub name: String,
779    /// Canonical Subnet principal recorded by the Dashboard.
780    pub subnet_id: String,
781    /// Canonically ordered controller entries recorded by the Dashboard.
782    pub controllers: Vec<IcCanisterPageController>,
783    /// Raw Dashboard language label.
784    pub language: String,
785    /// Raw current module hash.
786    pub module_hash: String,
787    /// Raw Dashboard row update timestamp.
788    pub dashboard_updated_at: String,
789}
790
791///
792/// IcCanisterPageReport
793///
794/// One explicitly bounded page from the official Dashboard canister collection.
795///
796
797#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
798pub struct IcCanisterPageReport {
799    /// Shared Dashboard provenance, flattened in serialized report JSON.
800    #[serde(flatten)]
801    pub provenance: IcDashboardReportProvenance,
802    /// Filters applied by the Dashboard.
803    pub filters: IcCanisterFilters,
804    /// Maximum rows requested from the API.
805    pub requested_limit: u16,
806    /// Exclusive forward cursor supplied to this request.
807    pub after: Option<String>,
808    /// Exclusive backward cursor supplied to this request.
809    pub before: Option<String>,
810    /// Cursor for an explicit request for the preceding page.
811    pub previous_cursor: Option<String>,
812    /// Cursor for an explicit request for the following page.
813    pub next_cursor: Option<String>,
814    /// Canister discovery rows in Dashboard canister-id order.
815    pub rows: Vec<IcCanisterPageRow>,
816}