wsdp 0.1.0

Async high-level client for ČÚZK WSDP real-estate cadastre services
Documentation
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
use jiff::civil::Date;

use super::legal_relation::LegalRelationType;
use super::{
    CadastralAreaCode, CityDistrictCode, DistrictCode, MessageCode, MunicipalityCode,
    MunicipalityPartCode, NewRegionCode, RegionCode, StreetCode, WorkplaceCode,
};

/// A typed request for one of the 33 WSDP 3.1 code-list operations.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum CodeListRequest {
    /// Lists available code lists, optionally restricted to records changed on or after a date.
    CodeListInventory {
        /// Inclusive `zmenyOd` filter.
        changed_since: Option<Date>,
    },
    /// Lists municipality parts (`seznamCastiObci`).
    MunicipalityParts {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<MunicipalityPartFilter>,
    },
    /// Lists parcel-numbering methods (`seznamCislovaniParcel`).
    ParcelNumberingMethods,
    /// Lists land kinds (`seznamDruhuPozemku`).
    LandKinds,
    /// Lists historical cadastral areas (`seznamHistKU`).
    CadastralAreaHistory {
        /// Inclusive `zmenyOd` filter.
        changed_since: Option<Date>,
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<CadastralAreaHistoryFilter>,
    },
    /// Lists regions (`seznamKraju`).
    Regions,
    /// Lists current cadastral areas (`seznamKU`).
    CadastralAreas {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<CadastralAreaFilter>,
    },
    /// Lists city districts (`seznamMestskychCasti`).
    CityDistricts {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<CityDistrictFilter>,
    },
    /// Lists municipalities (`seznamObci`).
    Municipalities {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<MunicipalityFilter>,
    },
    /// Lists districts (`seznamOkresu`).
    Districts {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<DistrictFilter>,
    },
    /// Lists proceeding operations (`seznamOperaciRizeni`).
    ProceedingOperations,
    /// Lists cadastral workplaces (`seznamPracovist`).
    Workplaces {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<WorkplaceFilter>,
    },
    /// Lists proceeding subject matters (`seznamPredmetuRizeni`).
    ProceedingSubjects,
    /// Lists countries (`seznamStatu`).
    Countries {
        /// Optional country-name condition.
        filter: Option<CountryFilter>,
    },
    /// Lists unit types (`seznamTypuJednotek`).
    UnitTypes,
    /// Lists operation types (`seznamTypuOperaci`).
    OperationTypes,
    /// Lists authorized-subject types (`seznamTypuOS`).
    SubjectTypes,
    /// Lists parcel types from `seznamTypuParcel`.
    ParcelTypes,
    /// Lists legal-relation types (`seznamTypuPravnichVztahu`).
    LegalRelationTypes,
    /// Lists proceeding types (`seznamTypuRizeni`).
    ProceedingTypes,
    /// Lists building types (`seznamTypuStaveb`).
    BuildingTypes,
    /// Lists request purposes (`seznamUcelu`).
    RequestPurposes,
    /// Lists streets (`seznamUlic`).
    Streets {
        /// Optional single XSD choice used as the `kde` condition.
        filter: Option<StreetFilter>,
    },
    /// Lists area-determination methods (`seznamUrceniVymery`).
    AreaDeterminationMethods,
    /// Lists unit uses (`seznamVyuzitiJednotky`).
    UnitUses,
    /// Lists land uses (`seznamVyuzitiPozemku`).
    LandUses,
    /// Lists building uses (`seznamVyuzitiStavby`).
    BuildingUses,
    /// Lists protection methods (`seznamZpusobOchrany`).
    ProtectionMethods,
    /// Lists simplified-register numbering sources (`seznamZdrojuCislovaniZE`).
    SimplifiedRegisterNumberingSources,
    /// Lists service-message definitions (`seznamZprav`).
    ServiceMessages,
    /// Lists building-right purposes (`seznamUceluPS`).
    BuildingRightPurposes,
    /// Lists parcel kinds from the distinct `seznamTypParcely` operation.
    ParcelKinds,
    /// Lists authorized-subject characteristics (`seznamCharakteristikOS`).
    SubjectCharacteristics,
}

/// The single `kde` choice supported by `seznamCastiObci`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum MunicipalityPartFilter {
    /// Selects parts belonging to this municipality (`kodObce/odpovida`).
    Municipality(MunicipalityCode),
    /// Selects an exact municipality-part code (`kodCastiObce/odpovida`).
    Code(MunicipalityPartCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevCastiObce/obsahuje`).
    NameContains(String),
}

/// The single `kde` choice supported by `seznamHistKU`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum CadastralAreaHistoryFilter {
    /// Selects an exact cadastral-area code (`kodKU/odpovida`).
    Code(CadastralAreaCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevKU/obsahuje`).
    NameContains(String),
}

/// The single `kde` choice supported by `seznamKU`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum CadastralAreaFilter {
    /// Selects areas belonging to this municipality (`kodObce/odpovida`).
    Municipality(MunicipalityCode),
    /// Selects an exact cadastral-area code (`kodKU/odpovida`).
    Code(CadastralAreaCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevKU/obsahuje`).
    NameContains(String),
}

/// The single `kde` choice supported by `seznamMestskychCasti`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum CityDistrictFilter {
    /// Selects districts belonging to this municipality (`kodObce/odpovida`).
    Municipality(MunicipalityCode),
    /// Selects an exact city-district code (`kodMC/odpovida`).
    Code(CityDistrictCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevMC/obsahuje`).
    NameContains(String),
}

/// The single `kde` choice supported by `seznamObci`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum MunicipalityFilter {
    /// Selects an exact municipality code (`kodObce/odpovida`).
    Code(MunicipalityCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevObce/obsahuje`).
    NameContains(String),
    /// Selects municipalities in this district (`kodOkresu/odpovida`).
    District(DistrictCode),
}

/// The single `kde` choice supported by `seznamOkresu`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum DistrictFilter {
    /// Selects an exact district code (`kodOkresu/odpovida`).
    Code(DistrictCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevOkresu/obsahuje`).
    NameContains(String),
    /// Selects districts in this post-1960 region/VÚSC (`kodNovehoKraje/odpovida`).
    NewRegion(NewRegionCode),
}

/// The single `kde` choice supported by `seznamPracovist`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum WorkplaceFilter {
    /// Selects an exact workplace code (`kodKP/odpovida`).
    Code(WorkplaceCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevKP/obsahuje`).
    NameContains(String),
    /// Selects an exact email address (`email/odpovida`).
    Email(String),
    /// Selects an exact data-box identifier (`idDS/odpovida`).
    DataBoxId(String),
}

/// The single `kde` choice supported by `seznamStatu`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum CountryFilter {
    /// Selects names using the supplied SQL-LIKE pattern (`nazevStatu/obsahuje`).
    NameContains(String),
}

/// The single `kde` choice supported by `seznamUlic`.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum StreetFilter {
    /// Selects streets belonging to this municipality (`kodObce/odpovida`).
    Municipality(MunicipalityCode),
    /// Selects an exact street code (`kodUlice/odpovida`).
    Code(StreetCode),
    /// Selects names using the supplied SQL-LIKE pattern (`nazevUlice/obsahuje`).
    NameContains(String),
}

/// A decoded code list with its optional response-level update date.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CodeList<T> {
    /// Every returned item, including an empty list when the server returns no item elements.
    pub items: Vec<T>,
    /// The response attribute `posledniAktualizaceCiselniku`, when present.
    pub last_updated: Option<Date>,
}

/// The typed result corresponding to a [`CodeListRequest`] variant.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum CodeListResult {
    /// Result of `seznamCiselniku`.
    CodeListInventory(CodeList<CodeListDescription>),
    /// Result of `seznamCastiObci`.
    MunicipalityParts(CodeList<MunicipalityPart>),
    /// Result of `seznamCislovaniParcel`.
    ParcelNumberingMethods(CodeList<CodeListItem>),
    /// Result of `seznamDruhuPozemku`.
    LandKinds(CodeList<CodeListItem>),
    /// Result of `seznamHistKU`.
    CadastralAreaHistory(CodeList<HistoricalCadastralArea>),
    /// Result of `seznamKraju`.
    Regions(CodeList<Region>),
    /// Result of `seznamKU`.
    CadastralAreas(CodeList<CadastralArea>),
    /// Result of `seznamMestskychCasti`.
    CityDistricts(CodeList<CityDistrict>),
    /// Result of `seznamObci`.
    Municipalities(CodeList<Municipality>),
    /// Result of `seznamOkresu`.
    Districts(CodeList<District>),
    /// Result of `seznamOperaciRizeni`.
    ProceedingOperations(CodeList<ProceedingOperation>),
    /// Result of `seznamPracovist`.
    Workplaces(CodeList<Workplace>),
    /// Result of `seznamPredmetuRizeni`.
    ProceedingSubjects(CodeList<CodeListItem>),
    /// Result of `seznamStatu`.
    Countries(CodeList<CodeListItem>),
    /// Result of `seznamTypuJednotek`.
    UnitTypes(CodeList<CodeListItem>),
    /// Result of `seznamTypuOperaci`.
    OperationTypes(CodeList<CodeListItem>),
    /// Result of `seznamTypuOS`.
    SubjectTypes(CodeList<CodeListItem>),
    /// Result of `seznamTypuParcel`.
    ParcelTypes(CodeList<CodeListItem>),
    /// Result of `seznamTypuPravnichVztahu`.
    LegalRelationTypes(CodeList<LegalRelationType>),
    /// Result of `seznamTypuRizeni`.
    ProceedingTypes(CodeList<CodeListItem>),
    /// Result of `seznamTypuStaveb`.
    BuildingTypes(CodeList<CodeListItem>),
    /// Result of `seznamUcelu`.
    RequestPurposes(CodeList<CodeListItem>),
    /// Result of `seznamUlic`.
    Streets(CodeList<Street>),
    /// Result of `seznamUrceniVymery`.
    AreaDeterminationMethods(CodeList<CodeListItem>),
    /// Result of `seznamVyuzitiJednotky`.
    UnitUses(CodeList<CodeListItem>),
    /// Result of `seznamVyuzitiPozemku`.
    LandUses(CodeList<CodeListItem>),
    /// Result of `seznamVyuzitiStavby`.
    BuildingUses(CodeList<CodeListItem>),
    /// Result of `seznamZpusobOchrany`.
    ProtectionMethods(CodeList<CodeListItem>),
    /// Result of `seznamZdrojuCislovaniZE`.
    SimplifiedRegisterNumberingSources(CodeList<SimplifiedRegisterNumberingSource>),
    /// Result of `seznamZprav`.
    ServiceMessages(CodeList<ServiceMessageInfo>),
    /// Result of `seznamUceluPS`.
    BuildingRightPurposes(CodeList<CodeListItem>),
    /// Result of the distinct `seznamTypParcely` operation.
    ParcelKinds(CodeList<CodeListItem>),
    /// Result of `seznamCharakteristikOS`.
    SubjectCharacteristics(CodeList<SubjectCharacteristic>),
}

/// One available code list returned by `seznamCiselniku`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CodeListDescription {
    /// Operation name of the available code list.
    pub name: String,
    /// Required `datumPosledniZmeny` value for this individual code list.
    pub last_changed: Date,
}

/// A code/name pair used by operations without additional response fields.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CodeListItem {
    /// Raw server-maintained code, retained without numeric conversion or known-value restrictions.
    pub code: String,
    /// Human-readable code-list name.
    pub name: String,
}

/// A region returned by `seznamKraju`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Region {
    /// Region code.
    pub code: RegionCode,
    /// Region name.
    pub name: String,
}

/// A current cadastral area returned by `seznamKU`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CadastralArea {
    /// Cadastral-area code.
    pub code: CadastralAreaCode,
    /// Cadastral-area name.
    pub name: String,
    /// Optional parent municipality code (`kodObce`).
    pub municipality_code: Option<MunicipalityCode>,
}

/// A historical cadastral-area record returned by `seznamHistKU`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct HistoricalCadastralArea {
    /// Cadastral-area code.
    pub code: CadastralAreaCode,
    /// Historical cadastral-area name.
    pub name: String,
    /// Optional parent municipality code (`obecKod`).
    pub municipality_code: Option<MunicipalityCode>,
    /// Inclusive start of validity (`platnostOd`).
    pub valid_from: Date,
    /// Optional end of validity (`platnostDo`).
    pub valid_to: Option<Date>,
}

/// A city district returned by `seznamMestskychCasti`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CityDistrict {
    /// City-district code.
    pub code: CityDistrictCode,
    /// City-district name.
    pub name: String,
    /// Required parent municipality code (`kodObce`).
    pub municipality_code: MunicipalityCode,
}

/// A municipality returned by `seznamObci`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Municipality {
    /// Municipality code.
    pub code: MunicipalityCode,
    /// Municipality name.
    pub name: String,
    /// Parent district code (`okresKod`).
    pub district_code: DistrictCode,
}

/// A municipality part returned by `seznamCastiObci`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct MunicipalityPart {
    /// Municipality-part code.
    pub code: MunicipalityPartCode,
    /// Municipality-part name.
    pub name: String,
    /// Parent municipality code (`obecKod`).
    pub municipality_code: MunicipalityCode,
}

/// A district returned by `seznamOkresu`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct District {
    /// District code.
    pub code: DistrictCode,
    /// District name.
    pub name: String,
    /// Parent post-1960 region/VÚSC code (`nkrajKod`).
    pub new_region_code: NewRegionCode,
}

/// A street returned by `seznamUlic`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Street {
    /// Street code.
    pub code: StreetCode,
    /// Street name.
    pub name: String,
    /// Parent municipality code (`kodObce`).
    pub municipality_code: MunicipalityCode,
}

/// A proceeding operation returned by `seznamOperaciRizeni`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ProceedingOperation {
    /// Raw operation code.
    pub code: String,
    /// Operation name.
    pub name: String,
    /// Optional unrestricted operation state (`stav`).
    pub state: Option<String>,
}

/// A cadastral workplace with all address and contact fields from `seznamPracovist`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Workplace {
    /// Workplace code.
    pub code: WorkplaceCode,
    /// Workplace name.
    pub name: String,
    /// Optional post-1960 region/VÚSC code (`nkrajKod`).
    pub new_region_code: Option<NewRegionCode>,
    /// Optional email address.
    pub email: Option<String>,
    /// Optional data-box identifier (`datovaSchranka`).
    pub data_box_id: Option<String>,
    /// Optional street name (`nazevUlice`).
    pub street_name: Option<String>,
    /// Optional building/house number (`cisloDomovni`), retaining its lexical representation.
    pub house_number: Option<String>,
    /// Optional orientation number (`cisloOrientacni`).
    pub orientation_number: Option<String>,
    /// Optional postal code (`psc`), retaining leading zeroes.
    pub postal_code: Option<String>,
    /// Optional municipality name (`obec`).
    pub municipality: Option<String>,
    /// Optional municipality-part name (`castObce`).
    pub municipality_part: Option<String>,
    /// Optional district name (`okres`).
    pub district: Option<String>,
}

/// A simplified-register parcel-numbering source returned by `seznamZdrojuCislovaniZE`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SimplifiedRegisterNumberingSource {
    /// Raw source code.
    pub code: String,
    /// Source name.
    pub name: String,
    /// Required source abbreviation (`zkratka`).
    pub abbreviation: String,
}

/// A service-message definition returned by `seznamZprav`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ServiceMessageInfo {
    /// Known message code or its untouched unknown lexical value.
    pub code: MessageCode,
    /// Raw one-character message type (`typ`).
    pub kind: String,
    /// Human-readable message name.
    pub name: String,
}

/// An authorized-subject characteristic returned by `seznamCharakteristikOS`.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SubjectCharacteristic {
    /// Raw characteristic code.
    pub code: String,
    /// Characteristic name.
    pub name: String,
    /// Optional standard abbreviation (`zkratka`).
    pub abbreviation: Option<String>,
    /// Optional ALV abbreviation (`zkratkaALV`).
    pub alv_abbreviation: Option<String>,
}