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
#[derive(Debug, Deserialize)]
pub struct DomainInfo {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}contact", default)]
    pub contacts: Vec<DomainContact>,
}

#[derive(Debug, Deserialize)]
pub struct DomainContact {
    #[serde(rename = "$attr:type")]
    pub contact_type: DomainContactType,
    #[serde(rename = "$value")]
    pub contact_id: String,
}

#[derive(Debug, Deserialize, PartialEq, Eq)]
pub enum DomainContactType {
    #[serde(rename = "zone")]
    Zone,
}

#[derive(Debug, Serialize)]
pub struct DomainCreateRenew {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:cardID")]
    pub card_id: u32,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:cardCVC")]
    pub card_cvc: String,
}

#[derive(Debug, Serialize)]
pub struct DomainUpdate {
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:rem",
        skip_serializing_if = "Option::is_none"
    )]
    pub remove: Option<DomainUpdateRemove>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:chg",
        skip_serializing_if = "Option::is_none"
    )]
    pub change: Option<DomainUpdateChange>,
}

#[derive(Debug, Serialize)]
pub struct DomainUpdateRemove {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:ns_all")]
    pub ns_all: bool,
}

#[derive(Debug, Serialize)]
pub struct DomainUpdateChange {
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:master_ns",
        skip_serializing_if = "Option::is_none"
    )]
    pub master_ns: Option<DomainUpdateNS>,
}

#[derive(Debug, Serialize)]
pub struct DomainUpdateNS {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-domain-1.0}is-domain:hostObj")]
    pub hosts: Vec<String>,
}

#[derive(Debug, Deserialize)]
pub struct ContactInfo {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}type")]
    pub contact_type: ContactType,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}status")]
    pub status: Vec<ContactStatus>,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}mobile", default)]
    pub mobile: Option<super::contact::EPPContactPhone>,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}sid", default)]
    pub sid: Option<String>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}autoUpdateFromNationalRegistry",
        default
    )]
    pub auto_update_from_national_registry: Option<bool>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}cancelPaper",
        default
    )]
    pub cancel_paper: Option<bool>,
}

#[derive(Debug, Serialize)]
pub struct ContactCreate {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:type")]
    pub contact_type: ContactType,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:mobile",
        skip_serializing_if = "Option::is_none"
    )]
    pub mobile: Option<super::contact::EPPContactPhone>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:sid",
        skip_serializing_if = "Option::is_none"
    )]
    pub sid: Option<String>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:autoUpdateFromNationalRegistry",
        skip_serializing_if = "Option::is_none"
    )]
    pub auto_update_from_national_registry: Option<bool>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:cancelPaper",
        skip_serializing_if = "Option::is_none"
    )]
    pub cancel_paper: Option<bool>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:lang",
        skip_serializing_if = "Option::is_none"
    )]
    pub lang: Option<String>,
}

#[derive(Debug, Serialize)]
pub struct ContactUpdate {
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:chg",
        skip_serializing_if = "Option::is_none"
    )]
    pub change: Option<ContactUpdateChange>,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:oldPW")]
    pub old_password: String,
}

#[derive(Debug, Serialize)]
pub struct ContactUpdateChange {
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:mobile",
        skip_serializing_if = "Option::is_none"
    )]
    pub mobile: Option<super::contact::EPPContactPhone>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:autoUpdateFromNationalRegistry",
        skip_serializing_if = "Option::is_none"
    )]
    pub auto_update_from_national_registry: Option<bool>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:cancelPaper",
        skip_serializing_if = "Option::is_none"
    )]
    pub cancel_paper: Option<bool>,
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-contact-1.0}is-contact:lang",
        skip_serializing_if = "Option::is_none"
    )]
    pub lang: Option<String>,
}

#[derive(Debug, Serialize, Deserialize)]
pub enum ContactType {
    #[serde(rename = "person")]
    Person,
    #[serde(rename = "role")]
    Role,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct ContactStatus {
    #[serde(rename = "$attr:s")]
    pub status_type: ContactStatusType,
    #[serde(rename = "$attr:lang", default)]
    pub language: Option<String>,
    #[serde(rename = "$value", default)]
    pub msg: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub enum ContactStatusType {
    #[serde(rename = "ok")]
    Ok,
    #[serde(rename = "okUnconfirmed")]
    OkUnconfirmed,
    #[serde(rename = "pendingCreate")]
    PendingCreate,
    #[serde(rename = "serverExpired")]
    ServerExpired,
    #[serde(rename = "serverSuspended")]
    ServerSuspended,
}

#[derive(Debug, Serialize)]
pub struct HostCreateUpdate {
    #[serde(
        rename = "{urn:is.isnic:xml:ns:is-ext-host-1.0}is-host:contact",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub contacts: Vec<HostContact>,
}

#[derive(Debug, Serialize)]
pub struct HostContact {
    #[serde(rename = "$value")]
    pub id: String,
    #[serde(rename = "$attr:type")]
    pub contact_type: HostContactType,
}

#[derive(Debug, Serialize)]
pub enum HostContactType {
    #[serde(rename = "admin")]
    Admin,
}

#[derive(Debug, Deserialize)]
pub struct AccountInfo {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}account", default)]
    pub accounts: Vec<Account>,
}

#[derive(Debug, Deserialize)]
pub struct Account {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}id")]
    pub id: u32,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}contactHandle")]
    pub handle: String,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}allowedContactHandles")]
    pub allowed_contact_handles: AccountAllowedContactHandles,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}number", default)]
    pub number: Option<String>,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}owner")]
    pub owner: String,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}expireYear")]
    pub expiry_year: u32,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}expireMonth")]
    pub expiry_month: u32,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}brand")]
    pub brand: AccountBrand,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}currency", default)]
    pub currency: Option<String>,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}balance")]
    pub balance: f64,
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}backupAccountID")]
    pub backup_account_id: u32,
}

#[derive(Debug, Deserialize)]
pub struct AccountAllowedContactHandles {
    #[serde(rename = "{urn:is.isnic:xml:ns:is-ext-account-1.0}contact")]
    pub contacts: Vec<String>,
}

#[derive(Debug, Deserialize)]
pub enum AccountBrand {
    ISNICPrePaid,
    Visa,
    Mastercard,
    Jcb,
}