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 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 /// Whether the rows came from a live collection or the joined catalog cache.
26 pub data_source: ReportDataSource,
27 /// Complete snapshot path when `data_source` is `cache`.
28 pub cache_path: Option<String>,
29 /// Whether the cache provenance represents an API-exhausted complete snapshot.
30 pub cache_complete: Option<bool>,
31 /// Whether the view includes SNS instances outside the normal visible lifecycle set.
32 pub all_lifecycles: bool,
33 pub verbose: bool,
34 pub sort: String,
35 /// Number of SNS instances in the complete joined catalog before view filtering.
36 pub catalog_sns_count: usize,
37 /// Number of catalog rows excluded by lifecycle filtering.
38 pub excluded_sns_count: usize,
39 pub sns_count: usize,
40 pub metadata_error_count: usize,
41 /// Number of returned rows carrying a bounded lifecycle query error.
42 pub lifecycle_error_count: usize,
43 pub sns_instances: Vec<SnsListRow>,
44}
45
46///
47/// SnsListRow
48///
49/// Serializable row for one deployed SNS in a list report.
50///
51
52#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
53pub struct SnsListRow {
54 pub id: usize,
55 pub name: String,
56 /// Complete deployed-SNS canister identity, serialized as the existing flat fields.
57 #[serde(flatten)]
58 pub canisters: MainnetSnsCanisters,
59 pub metadata_error: Option<String>,
60 /// Native Swap lifecycle discriminant, when the lifecycle query succeeded.
61 pub lifecycle: Option<i32>,
62 /// Bounded lifecycle query failure retained instead of dropping the SNS row.
63 pub lifecycle_error: Option<String>,
64}
65
66///
67/// SnsInfoReport
68///
69/// Serializable report for one deployed SNS resolved by id or root principal.
70///
71
72#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
73pub struct SnsInfoReport {
74 pub schema_version: u32,
75 pub network: String,
76 pub sns_wasm_canister_id: String,
77 pub fetched_at: String,
78 pub source_endpoint: String,
79 pub fetched_by: String,
80 pub id: usize,
81 pub name: String,
82 pub description: Option<String>,
83 pub url: Option<String>,
84 /// Complete deployed-SNS canister identity, serialized as the existing flat fields.
85 #[serde(flatten)]
86 pub canisters: MainnetSnsCanisters,
87 pub metadata_error: Option<String>,
88}