1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct Category {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "category_group_id")]
pub category_group_id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "hidden")]
pub hidden: bool,
#[serde(rename = "original_category_group_id", skip_serializing_if = "Option::is_none")]
pub original_category_group_id: Option<String>,
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
#[serde(rename = "budgeted")]
pub budgeted: i64,
#[serde(rename = "activity")]
pub activity: i64,
#[serde(rename = "balance")]
pub balance: i64,
#[serde(rename = "goal_type", skip_serializing_if = "Option::is_none")]
pub goal_type: Option<String>,
#[serde(rename = "goal_creation_month", skip_serializing_if = "Option::is_none")]
pub goal_creation_month: Option<String>,
#[serde(rename = "goal_target")]
pub goal_target: i64,
#[serde(rename = "goal_target_month", skip_serializing_if = "Option::is_none")]
pub goal_target_month: Option<String>,
#[serde(rename = "goal_percentage_complete", skip_serializing_if = "Option::is_none")]
pub goal_percentage_complete: Option<i32>,
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl Category {
pub fn new(id: String, category_group_id: String, name: String, hidden: bool, budgeted: i64, activity: i64, balance: i64, goal_target: i64, deleted: bool) -> Category {
Category {
id: id,
category_group_id: category_group_id,
name: name,
hidden: hidden,
original_category_group_id: None,
note: None,
budgeted: budgeted,
activity: activity,
balance: balance,
goal_type: None,
goal_creation_month: None,
goal_target: goal_target,
goal_target_month: None,
goal_percentage_complete: None,
deleted: deleted,
}
}
}
#[derive(Debug, Serialize, Deserialize)]
pub enum GoalType {
#[serde(rename = "TB")]
TB,
#[serde(rename = "TBD")]
TBD,
#[serde(rename = "MF")]
MF,
}