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::ReportProvenance;
8use crate::sns::report::model::MainnetSnsCanisters;
9use serde::Serialize;
10
11///
12/// SnsListReport
13///
14/// Serializable report for deployed SNS listings.
15///
16
17#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
18pub struct SnsListReport {
19    pub schema_version: u32,
20    pub network: String,
21    pub sns_wasm_canister_id: String,
22    pub fetched_at: String,
23    pub source_endpoint: String,
24    pub fetched_by: String,
25    /// Shared record, flattened in serialized output.
26    #[serde(flatten)]
27    pub provenance: ReportProvenance,
28    /// Whether the view includes SNS instances outside the normal visible lifecycle set.
29    pub all_lifecycles: bool,
30    pub verbose: bool,
31    pub sort: String,
32    /// Number of SNS instances in the complete joined catalog before view filtering.
33    pub catalog_sns_count: usize,
34    /// Number of catalog rows excluded by lifecycle filtering.
35    pub excluded_sns_count: usize,
36    pub sns_count: usize,
37    pub metadata_error_count: usize,
38    /// Number of returned rows carrying a bounded lifecycle query error.
39    pub lifecycle_error_count: usize,
40    pub sns_instances: Vec<SnsListRow>,
41}
42
43///
44/// SnsListRow
45///
46/// Serializable row for one deployed SNS in a list report.
47///
48
49#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
50pub struct SnsListRow {
51    pub id: usize,
52    pub name: String,
53    /// Complete deployed-SNS canister identity, serialized as the existing flat fields.
54    #[serde(flatten)]
55    pub canisters: MainnetSnsCanisters,
56    pub metadata_error: Option<String>,
57    /// Native Swap lifecycle discriminant, when the lifecycle query succeeded.
58    pub lifecycle: Option<i32>,
59    /// Bounded lifecycle query failure retained instead of dropping the SNS row.
60    pub lifecycle_error: Option<String>,
61}
62
63///
64/// SnsInfoReport
65///
66/// Serializable report for one deployed SNS resolved by id or root principal.
67///
68
69#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
70pub struct SnsInfoReport {
71    pub schema_version: u32,
72    pub network: String,
73    pub sns_wasm_canister_id: String,
74    pub fetched_at: String,
75    pub source_endpoint: String,
76    pub fetched_by: String,
77    pub id: usize,
78    pub name: String,
79    pub description: Option<String>,
80    pub url: Option<String>,
81    /// Complete deployed-SNS canister identity, serialized as the existing flat fields.
82    #[serde(flatten)]
83    pub canisters: MainnetSnsCanisters,
84    pub metadata_error: Option<String>,
85}