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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
#![allow(dead_code)]
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_json::Value;
#[derive(serde::Deserialize, std::fmt::Debug)]
pub struct Token {
pub token: String,
pub expires: u32,
}
#[derive(serde::Deserialize, std::fmt::Debug)]
pub struct TokenResponse {
pub status: Status,
pub response: Token,
}
#[derive(serde::Deserialize, std::fmt::Debug)]
#[serde(rename_all = "camelCase")]
pub struct AccessTokenResponse {
pub access_token: String,
pub refresh_token: String,
}
#[derive(serde::Deserialize, std::fmt::Debug)]
pub struct LoginResponse {
pub status: Status,
pub response: AccessTokenResponse,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OfferResponse {
pub status: Status,
pub response: Option<OfferList>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Status {
pub code: i64,
pub type_field: String,
#[serde(rename = "correlationID")]
pub correlation_id: Option<String>,
pub message: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OfferList {
pub offers: Vec<Offer>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Offer {
pub offer_id: i64,
pub offer_proposition_id: i64,
pub offer_type: i64,
pub local_valid_from: String,
pub local_valid_to: String,
#[serde(rename = "validFromUTC")]
pub valid_from_utc: String,
#[serde(rename = "validToUTC")]
pub valid_to_utc: String,
pub name: String,
pub short_description: String,
pub long_description: String,
pub image_base_name: String,
pub image_base_language: String,
pub redemption_mode: i64,
pub is_archived: bool,
#[serde(rename = "isSLPOffer")]
pub is_slpoffer: bool,
pub is_locked: bool,
pub is_redeemed: bool,
pub offer_bucket: String,
pub punch_info: PunchInfo,
pub recurring_info: RecurringInfo,
pub conditions: Conditions,
pub color_coding_info: i64,
pub isvalid_total_order: bool,
#[serde(rename = "CreationDateUtc")]
pub creation_date_utc: String,
#[serde(rename = "extendToEOD")]
pub extend_to_eod: bool,
pub is_dynamic_expiration: bool,
pub daypart_filters: Vec<Value>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PunchInfo {
pub total_punch: i64,
pub current_punch: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecurringInfo {
pub total_redemption_quantity: Option<i64>,
pub current_day_redemption_quantity: Option<i64>,
pub current_week_redemption_quantity: Option<i64>,
pub current_month_redemption_quantity: Option<i64>,
pub max_redemption_quantity: Option<i64>,
pub max_redemption_quantity_per_day: Option<i64>,
pub max_redemption_quantity_per_week: Option<i64>,
pub max_redemption_quantity_per_month: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Conditions {
pub day_of_week_conditions: Vec<String>,
pub date_conditions: Vec<Value>,
pub sale_amount_conditions: Vec<SaleAmountCondition>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SaleAmountCondition {
pub include_eligible: bool,
pub minimum: i64,
pub pre_tax_validation: bool,
pub include_non_product: bool,
pub exclude_codes: String,
pub include_gift_coupons: bool,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RestaurantLocationResponse {
pub status: Status,
pub response: Option<RestaurantLocationList>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RestaurantLocationList {
pub restaurants: Vec<Restaurant>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Restaurant {
pub restaurant_status: String,
pub facilities: Vec<String>,
pub address: Address,
pub mc_deliveries: McDeliveries,
pub location: Location,
pub name: String,
pub national_store_number: i64,
pub status: i64,
pub time_zone: String,
pub week_opening_hours: Vec<WeekOpeningHour>,
pub phone_number: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Address {
pub address_line1: String,
pub city_town: String,
pub country: String,
pub postal_zip: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct McDeliveries {
pub mc_delivery: Vec<Value>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Location {
pub latitude: f64,
pub longitude: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WeekOpeningHour {
pub services: Vec<Service>,
pub day_of_week_id: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Service {
pub end_time: String,
pub is_open: bool,
pub service_name: String,
pub start_time: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OfferDetailsResponse {
pub status: Status,
pub response: Option<OfferDetails>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OfferDetails {
pub order_discount_type: i64,
pub offer_proposition_id: i64,
pub offer_type: i64,
pub offer_bucket: String,
pub is_locked: bool,
pub isvalid_total_order: bool,
#[serde(rename = "isSLPOffer")]
pub is_slpoffer: bool,
pub color_coding_info: i64,
pub local_valid_from: String,
pub local_valid_to: String,
#[serde(rename = "validFromUTC")]
pub valid_from_utc: String,
#[serde(rename = "validToUTC")]
pub valid_to_utc: String,
pub name: String,
pub short_description: String,
pub long_description: String,
pub image_base_name: String,
pub image_base_language: String,
pub redemption_mode: i64,
pub is_expired: bool,
pub product_sets: Vec<ProductSet>,
pub restaurants: Vec<Value>,
pub frequency_offer_info: FrequencyOfferInfo,
pub recurring_info: RecurringInfo,
pub conditions: Conditions,
pub is_dynamic_expiration: bool,
#[serde(rename = "exclusiveTOD")]
pub exclusive_tod: bool,
pub daypart_filters: Vec<Value>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProductSet {
pub alias: String,
pub quantity: i64,
pub min_quantity: i64,
pub products: Vec<String>,
pub action: Action,
pub swap_mapping: Vec<Value>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Action {
#[serde(rename = "type")]
pub type_field: i64,
pub discount_type: i64,
pub value: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct FrequencyOfferInfo {
pub total_punch: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OfferDealStackResponse {
pub status: Status,
pub response: Option<OfferDealStack>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OfferDealStack {
pub random_code: String,
pub bar_code_content: String,
pub expiration_time: String,
pub deal_stack: Option<Vec<DealStack>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DealStack {
pub offer_id: i64,
pub offer_proposition_id: String,
pub state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LoginRefreshResponse {
pub response: Option<LoginRefreshResp>,
pub status: Status,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LoginRefreshResp {
pub access_token: String,
pub refresh_token: String,
}