Skip to main content

canic_core/dto/
state.rs

1use crate::dto::prelude::*;
2
3//
4// AppCommand
5//
6
7#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
8pub enum AppCommand {
9    SetStatus(AppStatus),
10    SetCyclesFundingEnabled(bool),
11}
12
13//
14// AppStatus
15//
16
17#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
18pub enum AppStatus {
19    Active,
20    Readonly,
21    Stopped,
22}
23
24//
25// AppMode
26//
27
28#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
29pub enum AppMode {
30    Enabled,
31    Readonly,
32    Disabled,
33}
34
35//
36// AppStateInput
37//
38
39#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
40pub struct AppStateInput {
41    pub mode: AppMode,
42    pub cycles_funding_enabled: bool,
43}
44
45//
46// AppStateResponse
47//
48
49#[derive(CandidType, Deserialize)]
50pub struct AppStateResponse {
51    pub mode: AppMode,
52    pub cycles_funding_enabled: bool,
53}
54
55//
56// SubnetStateInput
57//
58
59#[derive(CandidType, Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq)]
60pub struct SubnetStateInput;
61
62//
63// SubnetStateResponse
64//
65
66#[derive(CandidType, Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq)]
67pub struct SubnetStateResponse;
68
69//
70// BootstrapStatusResponse
71//
72
73#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
74pub struct BootstrapStatusResponse {
75    pub ready: bool,
76    pub phase: String,
77    pub last_error: Option<String>,
78}