Skip to main content

ic_query/sns/report/model/reports/
list.rs

1//! Module: sns::report::model::reports::list
2//!
3//! Responsibility: deployed SNS list and info report DTOs.
4//! Does not own: SNS-W fetching, metadata lookup, sorting, or rendering.
5//! Boundary: preserves raw report fields for text and JSON output writers.
6
7use crate::report::ReportDataSource;
8use serde::Serialize;
9
10///
11/// SnsListReport
12///
13/// Serializable report for deployed SNS listings.
14///
15
16#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
17pub struct SnsListReport {
18    pub schema_version: u32,
19    pub network: String,
20    pub sns_wasm_canister_id: String,
21    pub fetched_at: String,
22    pub source_endpoint: String,
23    pub fetched_by: String,
24    /// Whether the rows came from a live collection or the joined catalog cache.
25    pub data_source: ReportDataSource,
26    /// Complete snapshot path when `data_source` is `cache`.
27    pub cache_path: Option<String>,
28    /// Whether the cache provenance represents an API-exhausted complete snapshot.
29    pub cache_complete: Option<bool>,
30    /// Whether the view includes SNS instances outside the normal visible lifecycle set.
31    pub all_lifecycles: bool,
32    pub verbose: bool,
33    pub sort: String,
34    /// Number of SNS instances in the complete joined catalog before view filtering.
35    pub catalog_sns_count: usize,
36    /// Number of catalog rows excluded by lifecycle filtering.
37    pub excluded_sns_count: usize,
38    pub sns_count: usize,
39    pub metadata_error_count: usize,
40    /// Number of returned rows carrying a bounded lifecycle query error.
41    pub lifecycle_error_count: usize,
42    pub sns_instances: Vec<SnsListRow>,
43}
44
45///
46/// SnsListRow
47///
48/// Serializable row for one deployed SNS in a list report.
49///
50
51#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
52pub struct SnsListRow {
53    pub id: usize,
54    pub name: String,
55    pub root_canister_id: String,
56    pub governance_canister_id: String,
57    pub ledger_canister_id: String,
58    pub swap_canister_id: String,
59    pub index_canister_id: String,
60    pub metadata_error: Option<String>,
61    /// Native Swap lifecycle discriminant, when the lifecycle query succeeded.
62    pub lifecycle: Option<i32>,
63    /// Stable native lifecycle label derived from `lifecycle`.
64    pub lifecycle_name: Option<String>,
65    /// Bounded lifecycle query failure retained instead of dropping the SNS row.
66    pub lifecycle_error: Option<String>,
67}
68
69///
70/// SnsInfoReport
71///
72/// Serializable report for one deployed SNS resolved by id or root principal.
73///
74
75#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
76pub struct SnsInfoReport {
77    pub schema_version: u32,
78    pub network: String,
79    pub sns_wasm_canister_id: String,
80    pub fetched_at: String,
81    pub source_endpoint: String,
82    pub fetched_by: String,
83    pub id: usize,
84    pub name: String,
85    pub description: Option<String>,
86    pub url: Option<String>,
87    pub root_canister_id: String,
88    pub governance_canister_id: String,
89    pub ledger_canister_id: String,
90    pub swap_canister_id: String,
91    pub index_canister_id: String,
92    pub metadata_error: Option<String>,
93}