Skip to main content

amlich_api/
dto.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct DateQuery {
5    pub day: i32,
6    pub month: i32,
7    pub year: i32,
8    pub timezone: Option<f64>,
9}
10
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct SolarDto {
13    pub day: i32,
14    pub month: i32,
15    pub year: i32,
16    pub day_of_week: usize,
17    pub day_of_week_name: String,
18    pub date_string: String,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct LunarDto {
23    pub day: i32,
24    pub month: i32,
25    pub year: i32,
26    pub is_leap_month: bool,
27    pub date_string: String,
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct NguHanhDto {
32    pub can: String,
33    pub chi: String,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct CanChiDto {
38    pub can_index: usize,
39    pub chi_index: usize,
40    pub can: String,
41    pub chi: String,
42    pub full: String,
43    pub con_giap: String,
44    pub ngu_hanh: NguHanhDto,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct CanChiInfoDto {
49    pub day: CanChiDto,
50    pub month: CanChiDto,
51    pub year: CanChiDto,
52    pub full: String,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
56pub struct TietKhiDto {
57    pub index: usize,
58    pub name: String,
59    pub description: String,
60    pub longitude: i32,
61    pub current_longitude: f64,
62    pub season: String,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct HourInfoDto {
67    pub hour_index: usize,
68    pub hour_chi: String,
69    pub time_range: String,
70    pub star: String,
71    pub is_good: bool,
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct GioHoangDaoDto {
76    pub day_chi: String,
77    pub good_hour_count: usize,
78    pub good_hours: Vec<HourInfoDto>,
79    pub all_hours: Vec<HourInfoDto>,
80    pub summary: String,
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize)]
84pub struct DayInfoDto {
85    pub solar: SolarDto,
86    pub lunar: LunarDto,
87    pub jd: i32,
88    pub canchi: CanChiInfoDto,
89    pub tiet_khi: TietKhiDto,
90    pub gio_hoang_dao: GioHoangDaoDto,
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
94pub struct HolidayDto {
95    pub name: String,
96    pub description: String,
97    pub solar_day: i32,
98    pub solar_month: i32,
99    pub solar_year: i32,
100    pub lunar_day: Option<i32>,
101    pub lunar_month: Option<i32>,
102    pub lunar_year: Option<i32>,
103    pub is_solar: bool,
104    pub category: String,
105    pub is_major: bool,
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
109pub struct LocalizedTextDto {
110    pub vi: String,
111    pub en: String,
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
115pub struct LocalizedListDto {
116    pub vi: Vec<String>,
117    pub en: Vec<String>,
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
121pub struct FoodInsightDto {
122    pub name: LocalizedTextDto,
123    pub description: LocalizedTextDto,
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
127pub struct TabooInsightDto {
128    pub action: LocalizedTextDto,
129    pub reason: LocalizedTextDto,
130}
131
132#[derive(Debug, Clone, Serialize, Deserialize)]
133pub struct ProverbInsightDto {
134    pub text: String,
135    pub meaning: LocalizedTextDto,
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
139pub struct RegionsInsightDto {
140    pub north: LocalizedTextDto,
141    pub central: LocalizedTextDto,
142    pub south: LocalizedTextDto,
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize)]
146pub struct FestivalInsightDto {
147    pub names: LocalizedListDto,
148    pub origin: Option<LocalizedTextDto>,
149    pub activities: Option<LocalizedListDto>,
150    pub food: Vec<FoodInsightDto>,
151    pub taboos: Vec<TabooInsightDto>,
152    pub proverbs: Vec<ProverbInsightDto>,
153    pub regions: Option<RegionsInsightDto>,
154    pub category: String,
155    pub is_major: bool,
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
159pub struct HolidayInsightDto {
160    pub names: LocalizedListDto,
161    pub origin: Option<LocalizedTextDto>,
162    pub significance: Option<LocalizedTextDto>,
163    pub activities: Option<LocalizedListDto>,
164    pub traditions: Option<LocalizedListDto>,
165    pub food: Vec<FoodInsightDto>,
166    pub taboos: Vec<TabooInsightDto>,
167    pub proverbs: Vec<ProverbInsightDto>,
168    pub regions: Option<RegionsInsightDto>,
169    pub category: String,
170    pub is_major: bool,
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
174pub struct ElementInsightDto {
175    pub key: String,
176    pub name: LocalizedTextDto,
177    pub nature: LocalizedTextDto,
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
181pub struct CanInsightDto {
182    pub name: String,
183    pub element: String,
184    pub meaning: LocalizedTextDto,
185    pub nature: LocalizedTextDto,
186}
187
188#[derive(Debug, Clone, Serialize, Deserialize)]
189pub struct ChiInsightDto {
190    pub name: String,
191    pub animal: LocalizedTextDto,
192    pub element: String,
193    pub meaning: LocalizedTextDto,
194    pub hours: String,
195}
196
197#[derive(Debug, Clone, Serialize, Deserialize)]
198pub struct CanChiInsightDto {
199    pub can: CanInsightDto,
200    pub chi: ChiInsightDto,
201    pub element: Option<ElementInsightDto>,
202}
203
204#[derive(Debug, Clone, Serialize, Deserialize)]
205pub struct DayGuidanceDto {
206    pub good_for: LocalizedListDto,
207    pub avoid_for: LocalizedListDto,
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize)]
211pub struct TietKhiInsightDto {
212    pub id: String,
213    pub name: LocalizedTextDto,
214    pub longitude: i32,
215    pub meaning: LocalizedTextDto,
216    pub astronomy: LocalizedTextDto,
217    pub agriculture: LocalizedListDto,
218    pub health: LocalizedListDto,
219    pub weather: LocalizedTextDto,
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
223pub struct DayInsightDto {
224    pub solar: SolarDto,
225    pub lunar: LunarDto,
226    pub festival: Option<FestivalInsightDto>,
227    pub holiday: Option<HolidayInsightDto>,
228    pub canchi: Option<CanChiInsightDto>,
229    pub day_guidance: Option<DayGuidanceDto>,
230    pub tiet_khi: Option<TietKhiInsightDto>,
231}