#[allow(unused_imports)]
use super::{common as com, common_extension as comx, location_referencing as loc, location_extension as locx, situation as sit, road_traffic_data as roa, vms, parking as prk, energy_infrastructure as egi, afir_energy_infrastructure as aegi, facilities as fac, afir_facilities as afac, traffic_regulation as tro, traffic_management_plan as tmp, rerouting_management_enhanced as rer, urban_extensions as ubx, fault_and_status as fst};
#[allow(unused_imports)]
use crate::out::{Out, Pattern};
#[allow(unused_imports)]
use crate::xml::{Enumeration, Xml};
#[allow(unused_imports)]
use crate::{Date, DateTime, Decimal, Error, Extension, MultilingualString, Time};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ActivationTypeEnum {
DynamicallyActivated,
Permanent,
Extended(String),
}
impl ActivationTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::DynamicallyActivated => "dynamicallyActivated",
Self::Permanent => "permanent",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ActivationTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"dynamicallyActivated" => Some(Self::DynamicallyActivated),
"permanent" => Some(Self::Permanent),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ActivationTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConditionTypeEnum {
AccessCondition,
DriverCondition,
LocationCondition,
NonVehicularRoadUserCondition,
OccupantConditions,
Other,
PermitCondition,
RegistrationCondition,
RetrofittingCondition,
RoadCondition,
StickerCondition,
ValidityCondition,
VehicleCondition,
Extended(String),
}
impl ConditionTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::AccessCondition => "accessCondition",
Self::DriverCondition => "driverCondition",
Self::LocationCondition => "locationCondition",
Self::NonVehicularRoadUserCondition => "nonVehicularRoadUserCondition",
Self::OccupantConditions => "occupantConditions",
Self::Other => "other",
Self::PermitCondition => "permitCondition",
Self::RegistrationCondition => "registrationCondition",
Self::RetrofittingCondition => "retrofittingCondition",
Self::RoadCondition => "roadCondition",
Self::StickerCondition => "stickerCondition",
Self::ValidityCondition => "validityCondition",
Self::VehicleCondition => "vehicleCondition",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ConditionTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"accessCondition" => Some(Self::AccessCondition),
"driverCondition" => Some(Self::DriverCondition),
"locationCondition" => Some(Self::LocationCondition),
"nonVehicularRoadUserCondition" => Some(Self::NonVehicularRoadUserCondition),
"occupantConditions" => Some(Self::OccupantConditions),
"other" => Some(Self::Other),
"permitCondition" => Some(Self::PermitCondition),
"registrationCondition" => Some(Self::RegistrationCondition),
"retrofittingCondition" => Some(Self::RetrofittingCondition),
"roadCondition" => Some(Self::RoadCondition),
"stickerCondition" => Some(Self::StickerCondition),
"validityCondition" => Some(Self::ValidityCondition),
"vehicleCondition" => Some(Self::VehicleCondition),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ConditionTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ControlledZoneStatusEnum {
Active,
Inactive,
Extended(String),
}
impl ControlledZoneStatusEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Active => "active",
Self::Inactive => "inactive",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ControlledZoneStatusEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"active" => Some(Self::Active),
"inactive" => Some(Self::Inactive),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ControlledZoneStatusEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ControlledZoneTypeEnum {
LimitedTrafficZone,
LowEmissionZone,
PedestrianZone,
RestrictedParkingZone,
ZeroEmissionZone,
Extended(String),
}
impl ControlledZoneTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::LimitedTrafficZone => "limitedTrafficZone",
Self::LowEmissionZone => "lowEmissionZone",
Self::PedestrianZone => "pedestrianZone",
Self::RestrictedParkingZone => "restrictedParkingZone",
Self::ZeroEmissionZone => "zeroEmissionZone",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ControlledZoneTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"limitedTrafficZone" => Some(Self::LimitedTrafficZone),
"lowEmissionZone" => Some(Self::LowEmissionZone),
"pedestrianZone" => Some(Self::PedestrianZone),
"restrictedParkingZone" => Some(Self::RestrictedParkingZone),
"zeroEmissionZone" => Some(Self::ZeroEmissionZone),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ControlledZoneTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EnforcementMethodTypeEnum {
Camera,
ManualStickerInspection,
CheckingVehiclePapers,
MobileLicensePlateControls,
Other,
Extended(String),
}
impl EnforcementMethodTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Camera => "camera",
Self::ManualStickerInspection => "manualStickerInspection",
Self::CheckingVehiclePapers => "checkingVehiclePapers",
Self::MobileLicensePlateControls => "mobileLicensePlateControls",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EnforcementMethodTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"camera" => Some(Self::Camera),
"manualStickerInspection" => Some(Self::ManualStickerInspection),
"checkingVehiclePapers" => Some(Self::CheckingVehiclePapers),
"mobileLicensePlateControls" => Some(Self::MobileLicensePlateControls),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EnforcementMethodTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RegistrableAccessTypeEnum {
AllowedForeignVehicle,
AllowedVehicleFromGuestOfResident,
AllowedVehicleFromResident,
VehicleFromDisabled,
Extended(String),
}
impl RegistrableAccessTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::AllowedForeignVehicle => "allowedForeignVehicle",
Self::AllowedVehicleFromGuestOfResident => "allowedVehicleFromGuestOfResident",
Self::AllowedVehicleFromResident => "allowedVehicleFromResident",
Self::VehicleFromDisabled => "vehicleFromDisabled",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RegistrableAccessTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"allowedForeignVehicle" => Some(Self::AllowedForeignVehicle),
"allowedVehicleFromGuestOfResident" => Some(Self::AllowedVehicleFromGuestOfResident),
"allowedVehicleFromResident" => Some(Self::AllowedVehicleFromResident),
"vehicleFromDisabled" => Some(Self::VehicleFromDisabled),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RegistrableAccessTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlternativeMobilityOptions {
pub description: Option<MultilingualString>,
pub url: Option<com::Url>,
pub alternative_mobility_options_extension: Option<Box<Extension>>,
}
impl AlternativeMobilityOptions {
const FIELDS: &'static [u32] = &[0x50777, 0x50c0e, 0x50419];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5002c);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x50777 => { let v = r.multilingual()?; r.set(&mut e0, v, 1911); }
0x50c0e => { let v = r.string()?; r.set(&mut e1, v, 3086); }
0x50419 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1049); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
description: e0,
url: e1,
alternative_mobility_options_extension: e2,
};
r.close();
Ok(v)
}
}
impl AlternativeMobilityOptions {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.description { w.multilingual("cz:description", v)?; }
if let Some(v) = &self.url { w.leaf("cz:url", v)?; }
if let Some(v) = &self.alternative_mobility_options_extension { w.extension("cz:_alternativeMobilityOptionsExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ControlledZone {
pub id: Option<String>,
pub version: Option<String>,
pub name: Option<MultilingualString>,
pub controlled_zone_type: Vec<ControlledZoneTypeEnum>,
pub description: Option<MultilingualString>,
pub record_version_time: Option<DateTime>,
pub activation_type: Option<ActivationTypeEnum>,
pub status: Option<tro::ActivationStatusEnum>,
pub dynamic_activation_publication_source: Option<Box<com::VersionedReference>>,
pub controlled_zone_summary: Option<Box<ControlledZoneSummary>>,
pub traffic_regulation_order: Vec<tro::AnyTrafficRegulationOrder>,
pub controlled_zone_regulation: Vec<ControlledZoneRegulation>,
pub tariff_information: Vec<fac::Rates>,
pub alternative_mobility_options: Vec<AlternativeMobilityOptions>,
pub controlled_zone_extension: Option<Box<Extension>>,
}
impl ControlledZone {
const FIELDS: &'static [u32] = &[0x50949, 0x50742, 0x50777, 0x50ab5, 0x50681, 0x50b73, 0x507ad, 0x5073f, 0x50be1, 0x5073e, 0x50b9f, 0x506b1, 0x5044b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5005e);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = Vec::new();
let mut e11 = Vec::new();
let mut e12 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x50949 => { let v = r.multilingual()?; r.set(&mut e0, v, 2377); }
0x50742 => { let v = r.enumeration::<ControlledZoneTypeEnum>()?; e1.extend(v); }
0x50777 => { let v = r.multilingual()?; r.set(&mut e2, v, 1911); }
0x50ab5 => { let v = r.date_time()?; r.set(&mut e3, v, 2741); }
0x50681 => { let v = r.enumeration::<ActivationTypeEnum>()?; r.set(&mut e4, v, 1665); }
0x50b73 => { let v = r.enumeration::<tro::ActivationStatusEnum>()?; r.set(&mut e5, v, 2931); }
0x507ad => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e6, v.map(Box::new), 1965); }
0x5073f => { let v = Some(ControlledZoneSummary::read(r)?); r.set(&mut e7, v.map(Box::new), 1855); }
0x50be1 => { let v = tro::AnyTrafficRegulationOrder::read(r)?; e8.extend(v); }
0x5073e => { let v = Some(ControlledZoneRegulation::read(r)?); e9.extend(v); }
0x50b9f => { let v = fac::Rates::read(r)?; e10.extend(v); }
0x506b1 => { let v = Some(AlternativeMobilityOptions::read(r)?); e11.extend(v); }
0x5044b => { let v = r.raw()?; r.set(&mut e12, v.map(Box::new), 1099); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2741);
r.required(&e5, 2931);
let v = Self {
id: a0,
version: a1,
name: e0,
controlled_zone_type: e1,
description: e2,
record_version_time: e3,
activation_type: e4,
status: e5,
dynamic_activation_publication_source: e6,
controlled_zone_summary: e7,
traffic_regulation_order: e8,
controlled_zone_regulation: e9,
tariff_information: e10,
alternative_mobility_options: e11,
controlled_zone_extension: e12,
};
r.close();
Ok(v)
}
}
impl ControlledZone {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
if let Some(v) = &self.name { w.multilingual("cz:name", v)?; }
for v in &self.controlled_zone_type { w.enumeration("cz:controlledZoneType", v.literal())?; }
if let Some(v) = &self.description { w.multilingual("cz:description", v)?; }
match &self.record_version_time {
Some(v) => { w.leaf("cz:recordVersionTime", v)?; }
None => return Err(w.missing("cz:recordVersionTime")),
}
if let Some(v) = &self.activation_type { w.enumeration("cz:activationType", v.literal())?; }
match &self.status {
Some(v) => { w.enumeration("cz:status", v.literal())?; }
None => return Err(w.missing("cz:status")),
}
if let Some(v) = &self.dynamic_activation_publication_source { v.write(w, "cz:dynamicActivationPublicationSource", "", " targetClass=\"cz:ControlledZoneTablePublication\"")?; }
if let Some(v) = &self.controlled_zone_summary { v.write(w, "cz:controlledZoneSummary", "", "")?; }
for v in &self.traffic_regulation_order { v.write(w, "cz:trafficRegulationOrder")?; }
for v in &self.controlled_zone_regulation { v.write(w, "cz:controlledZoneRegulation", "", "")?; }
for v in &self.tariff_information { v.write(w, "cz:tariffInformation")?; }
for v in &self.alternative_mobility_options { v.write(w, "cz:alternativeMobilityOptions", "", "")?; }
if let Some(v) = &self.controlled_zone_extension { w.extension("cz:_controlledZoneExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ControlledZoneActivation {
pub id: Option<String>,
pub version: Option<String>,
pub activation_time: Option<DateTime>,
pub activation_version_time: Option<DateTime>,
pub validity: Option<Box<com::Validity>>,
pub activation_status_extension: Option<Box<Extension>>,
pub controlled_zone_reference: Option<Box<com::VersionedReference>>,
pub controlled_zone_activation_extension: Option<Box<Extension>>,
}
impl ControlledZoneActivation {
const FIELDS: &'static [u32] = &[0x5067f, 0x50682, 0x50c26, 0x503ff, 0x5073d, 0x5044a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5005f);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x5067f => { let v = r.date_time()?; r.set(&mut e0, v, 1663); }
0x50682 => { let v = r.date_time()?; r.set(&mut e1, v, 1666); }
0x50c26 => { let v = Some(com::Validity::read(r)?); r.set(&mut e2, v.map(Box::new), 3110); }
0x503ff => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1023); }
0x5073d => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 1853); }
0x5044a => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1098); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1663);
r.required(&e1, 1666);
r.required(&e2, 3110);
r.required(&e4, 1853);
let v = Self {
id: a0,
version: a1,
activation_time: e0,
activation_version_time: e1,
validity: e2,
activation_status_extension: e3,
controlled_zone_reference: e4,
controlled_zone_activation_extension: e5,
};
r.close();
Ok(v)
}
}
impl ControlledZoneActivation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
match &self.activation_time {
Some(v) => { w.leaf("cz:activationTime", v)?; }
None => return Err(w.missing("cz:activationTime")),
}
match &self.activation_version_time {
Some(v) => { w.leaf("cz:activationVersionTime", v)?; }
None => return Err(w.missing("cz:activationVersionTime")),
}
match &self.validity {
Some(v) => { v.write(w, "cz:validity", "", "")?; }
None => return Err(w.missing("cz:validity")),
}
if let Some(v) = &self.activation_status_extension { w.extension("cz:_activationStatusExtension", v)?; }
match &self.controlled_zone_reference {
Some(v) => { v.write(w, "cz:controlledZoneReference", "", " targetClass=\"cz:ControlledZone\"")?; }
None => return Err(w.missing("cz:controlledZoneReference")),
}
if let Some(v) = &self.controlled_zone_activation_extension { w.extension("cz:_controlledZoneActivationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ControlledZoneRegulation {
pub id: Option<String>,
pub version: Option<String>,
pub status: Option<tro::ActivationStatusEnum>,
pub road_sign: Vec<tro::RoadSign>,
pub type_of_regulation: Vec<tro::TypeOfRegulation>,
pub condition: Option<tro::Condition>,
pub permit_information: Vec<tro::PermitInformation>,
pub traffic_regulation_extension: Option<Box<Extension>>,
pub enforcement_method_type: Vec<EnforcementMethodTypeEnum>,
pub penalty: Vec<Penalty>,
pub controlled_zone_regulation_extension: Option<Box<Extension>>,
}
impl ControlledZoneRegulation {
const FIELDS: &'static [u32] = &[0x110b73, 0x110aff, 0x110c02, 0x110731, 0x110a23, 0x110617, 0x507de, 0x50a17, 0x5044c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50060);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = Vec::new();
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = None;
let mut e6 = Vec::new();
let mut e7 = Vec::new();
let mut e8 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x110b73 => { let v = r.enumeration::<tro::ActivationStatusEnum>()?; r.set(&mut e0, v, 2931); }
0x110aff => { let v = tro::RoadSign::read(r)?; e1.extend(v); }
0x110c02 => { let v = tro::TypeOfRegulation::read(r)?; e2.extend(v); }
0x110731 => { let v = tro::Condition::read(r)?; r.set(&mut e3, v, 1841); }
0x110a23 => { let v = Some(tro::PermitInformation::read(r)?); e4.extend(v); }
0x110617 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1559); }
0x507de => { let v = r.enumeration::<EnforcementMethodTypeEnum>()?; e6.extend(v); }
0x50a17 => { let v = Some(Penalty::read(r)?); e7.extend(v); }
0x5044c => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1100); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
version: a1,
status: e0,
road_sign: e1,
type_of_regulation: e2,
condition: e3,
permit_information: e4,
traffic_regulation_extension: e5,
enforcement_method_type: e6,
penalty: e7,
controlled_zone_regulation_extension: e8,
};
r.close();
Ok(v)
}
}
impl ControlledZoneRegulation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
if let Some(v) = &self.status { w.enumeration("tro:status", v.literal())?; }
for v in &self.road_sign { v.write(w, "tro:roadSign")?; }
for v in &self.type_of_regulation { v.write(w, "tro:typeOfRegulation")?; }
if let Some(v) = &self.condition { v.write(w, "tro:condition")?; }
for v in &self.permit_information { v.write(w, "tro:permitInformation", "", "")?; }
if let Some(v) = &self.traffic_regulation_extension { w.extension("tro:_trafficRegulationExtension", v)?; }
for v in &self.enforcement_method_type { w.enumeration("cz:enforcementMethodType", v.literal())?; }
for v in &self.penalty { v.write(w, "cz:penalty", "", "")?; }
if let Some(v) = &self.controlled_zone_regulation_extension { w.extension("cz:_controlledZoneRegulationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ControlledZoneSummary {
pub city_name: Option<MultilingualString>,
pub informal_name: Option<MultilingualString>,
pub url_for_further_information: Option<com::Url>,
pub location_for_display: Option<Box<loc::PointCoordinates>>,
pub controlled_zone_summary_extension: Option<Box<Extension>>,
}
impl ControlledZoneSummary {
const FIELDS: &'static [u32] = &[0x5071a, 0x50883, 0x50c0f, 0x508e2, 0x5044d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50061);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x5071a => { let v = r.multilingual()?; r.set(&mut e0, v, 1818); }
0x50883 => { let v = r.multilingual()?; r.set(&mut e1, v, 2179); }
0x50c0f => { let v = r.string()?; r.set(&mut e2, v, 3087); }
0x508e2 => { let v = Some(loc::PointCoordinates::read(r)?); r.set(&mut e3, v.map(Box::new), 2274); }
0x5044d => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1101); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
city_name: e0,
informal_name: e1,
url_for_further_information: e2,
location_for_display: e3,
controlled_zone_summary_extension: e4,
};
r.close();
Ok(v)
}
}
impl ControlledZoneSummary {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.city_name { w.multilingual("cz:cityName", v)?; }
if let Some(v) = &self.informal_name { w.multilingual("cz:informalName", v)?; }
if let Some(v) = &self.url_for_further_information { w.leaf("cz:urlForFurtherInformation", v)?; }
if let Some(v) = &self.location_for_display { v.write(w, "cz:locationForDisplay", "", "")?; }
if let Some(v) = &self.controlled_zone_summary_extension { w.extension("cz:_controlledZoneSummaryExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ControlledZoneTable {
pub controlled_zone_table_name: Option<MultilingualString>,
pub table_version_time: Option<DateTime>,
pub information_manager: Option<Box<com::InternationalIdentifier>>,
pub controlled_zone: Vec<ControlledZone>,
pub uvar_zone: Vec<ControlledZone>,
pub controlled_zone_table_extension: Option<Box<Extension>>,
}
impl ControlledZoneTable {
const FIELDS: &'static [u32] = &[0x50741, 0x50b9c, 0x50884, 0x5073c, 0x50c20, 0x5044e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50062);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = Vec::new();
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x50741 => { let v = r.multilingual()?; r.set(&mut e0, v, 1857); }
0x50b9c => { let v = r.date_time()?; r.set(&mut e1, v, 2972); }
0x50884 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e2, v.map(Box::new), 2180); }
0x5073c => { let v = Some(ControlledZone::read(r)?); e3.extend(v); }
0x50c20 => { let v = Some(ControlledZone::read(r)?); e4.extend(v); }
0x5044e => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1102); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2972);
let v = Self {
controlled_zone_table_name: e0,
table_version_time: e1,
information_manager: e2,
controlled_zone: e3,
uvar_zone: e4,
controlled_zone_table_extension: e5,
};
r.close();
Ok(v)
}
}
impl ControlledZoneTable {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.controlled_zone_table_name { w.multilingual("cz:controlledZoneTableName", v)?; }
match &self.table_version_time {
Some(v) => { w.leaf("cz:tableVersionTime", v)?; }
None => return Err(w.missing("cz:tableVersionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "cz:informationManager", "", "")?; }
for v in &self.controlled_zone { v.write(w, "cz:controlledZone", "", "")?; }
for v in &self.uvar_zone { v.write(w, "cz:uvarZone", "", "")?; }
if let Some(v) = &self.controlled_zone_table_extension { w.extension("cz:_controlledZoneTableExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ControlledZoneTablePublication {
pub lang: Option<com::Language>,
pub extension_name: Option<String>,
pub extension_version: Option<String>,
pub profile_name: Option<String>,
pub profile_version: Option<String>,
pub id: Option<String>,
pub feed_description: Option<MultilingualString>,
pub feed_type: Option<String>,
pub publication_time: Option<DateTime>,
pub publication_creator: Option<Box<com::InternationalIdentifier>>,
pub payload_publication_extension: Option<Box<Extension>>,
pub predefined_condition_publication_reference: Vec<com::VersionedReference>,
pub header_information: Option<Box<com::HeaderInformation>>,
pub controlled_zone_table: Vec<ControlledZoneTable>,
pub controlled_zone_table_publication_extension: Option<Box<Extension>>,
}
impl ControlledZoneTablePublication {
const FIELDS: &'static [u32] = &[0x3081d, 0x3081e, 0x30a94, 0x30a93, 0x30547, 0x50a5f, 0x50857, 0x50740, 0x5044f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50063);
let a0 = r.req_attr(2223);
let _ = r.attr(2373);
let a2 = r.attr(2046);
let a3 = r.attr(2047);
let a4 = r.attr(2689);
let a5 = r.attr(2690);
let a6 = r.req_attr(2159);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = Vec::new();
let mut e6 = None;
let mut e7 = Vec::new();
let mut e8 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x3081d => { let v = r.multilingual()?; r.set(&mut e0, v, 2077); }
0x3081e => { let v = r.string()?; r.set(&mut e1, v, 2078); }
0x30a94 => { let v = r.date_time()?; r.set(&mut e2, v, 2708); }
0x30a93 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2707); }
0x30547 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1351); }
0x50a5f => { let v = Some(com::VersionedReference::read(r)?); e5.extend(v); }
0x50857 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e6, v.map(Box::new), 2135); }
0x50740 => { let v = Some(ControlledZoneTable::read(r)?); e7.extend(v); }
0x5044f => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1103); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2708);
r.required(&e3, 2707);
r.required(&e6, 2135);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
id: a6,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
predefined_condition_publication_reference: e5,
header_information: e6,
controlled_zone_table: e7,
controlled_zone_table_publication_extension: e8,
};
r.close();
Ok(v)
}
}
impl ControlledZoneTablePublication {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.constant_attrs(" modelBaseVersion=\"3\"")?;
match &self.lang {
Some(v) => { w.pattern("lang", v, Pattern::Language)?; w.attr("lang", v)?; }
None => return Err(w.missing_attr("lang")),
}
if let Some(v) = &self.extension_name { w.attr("extensionName", v)?; }
if let Some(v) = &self.extension_version { w.attr("extensionVersion", v)?; }
if let Some(v) = &self.profile_name { w.attr("profileName", v)?; }
if let Some(v) = &self.profile_version { w.attr("profileVersion", v)?; }
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
if let Some(v) = &self.feed_description { w.multilingual("com:feedDescription", v)?; }
if let Some(v) = &self.feed_type { w.max_len("feedType", v, 1024)?; w.leaf("com:feedType", v)?; }
match &self.publication_time {
Some(v) => { w.leaf("com:publicationTime", v)?; }
None => return Err(w.missing("com:publicationTime")),
}
match &self.publication_creator {
Some(v) => { v.write(w, "com:publicationCreator", "", "")?; }
None => return Err(w.missing("com:publicationCreator")),
}
if let Some(v) = &self.payload_publication_extension { w.extension("com:_payloadPublicationExtension", v)?; }
for v in &self.predefined_condition_publication_reference { v.write(w, "cz:predefinedConditionPublicationReference", "", " targetClass=\"tro:PredefinedConditionPublication\"")?; }
match &self.header_information {
Some(v) => { v.write(w, "cz:headerInformation", "", "")?; }
None => return Err(w.missing("cz:headerInformation")),
}
w.count("cz:controlledZoneTable", self.controlled_zone_table.len(), 1, usize::MAX)?;
for v in &self.controlled_zone_table { v.write(w, "cz:controlledZoneTable", "", "")?; }
if let Some(v) = &self.controlled_zone_table_publication_extension { w.extension("cz:_controlledZoneTablePublicationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DynamicActivationStatusPublication {
pub lang: Option<com::Language>,
pub extension_name: Option<String>,
pub extension_version: Option<String>,
pub profile_name: Option<String>,
pub profile_version: Option<String>,
pub id: Option<String>,
pub feed_description: Option<MultilingualString>,
pub feed_type: Option<String>,
pub publication_time: Option<DateTime>,
pub publication_creator: Option<Box<com::InternationalIdentifier>>,
pub payload_publication_extension: Option<Box<Extension>>,
pub predefined_condition_publication_reference: Vec<com::VersionedReference>,
pub header_information: Option<Box<com::HeaderInformation>>,
pub activation_status: Vec<ActivationStatus>,
pub dynamic_activation_status_publication_extension: Option<Box<Extension>>,
}
impl DynamicActivationStatusPublication {
const FIELDS: &'static [u32] = &[0x3081d, 0x3081e, 0x30a94, 0x30a93, 0x30547, 0x50a5f, 0x50857, 0x5067e, 0x50476];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5008b);
let a0 = r.req_attr(2223);
let _ = r.attr(2373);
let a2 = r.attr(2046);
let a3 = r.attr(2047);
let a4 = r.attr(2689);
let a5 = r.attr(2690);
let a6 = r.req_attr(2159);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = Vec::new();
let mut e6 = None;
let mut e7 = Vec::new();
let mut e8 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x3081d => { let v = r.multilingual()?; r.set(&mut e0, v, 2077); }
0x3081e => { let v = r.string()?; r.set(&mut e1, v, 2078); }
0x30a94 => { let v = r.date_time()?; r.set(&mut e2, v, 2708); }
0x30a93 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2707); }
0x30547 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1351); }
0x50a5f => { let v = Some(com::VersionedReference::read(r)?); e5.extend(v); }
0x50857 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e6, v.map(Box::new), 2135); }
0x5067e => { let v = ActivationStatus::read(r)?; e7.extend(v); }
0x50476 => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1142); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2708);
r.required(&e3, 2707);
r.required(&e6, 2135);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
id: a6,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
predefined_condition_publication_reference: e5,
header_information: e6,
activation_status: e7,
dynamic_activation_status_publication_extension: e8,
};
r.close();
Ok(v)
}
}
impl DynamicActivationStatusPublication {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.constant_attrs(" modelBaseVersion=\"3\"")?;
match &self.lang {
Some(v) => { w.pattern("lang", v, Pattern::Language)?; w.attr("lang", v)?; }
None => return Err(w.missing_attr("lang")),
}
if let Some(v) = &self.extension_name { w.attr("extensionName", v)?; }
if let Some(v) = &self.extension_version { w.attr("extensionVersion", v)?; }
if let Some(v) = &self.profile_name { w.attr("profileName", v)?; }
if let Some(v) = &self.profile_version { w.attr("profileVersion", v)?; }
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
if let Some(v) = &self.feed_description { w.multilingual("com:feedDescription", v)?; }
if let Some(v) = &self.feed_type { w.max_len("feedType", v, 1024)?; w.leaf("com:feedType", v)?; }
match &self.publication_time {
Some(v) => { w.leaf("com:publicationTime", v)?; }
None => return Err(w.missing("com:publicationTime")),
}
match &self.publication_creator {
Some(v) => { v.write(w, "com:publicationCreator", "", "")?; }
None => return Err(w.missing("com:publicationCreator")),
}
if let Some(v) = &self.payload_publication_extension { w.extension("com:_payloadPublicationExtension", v)?; }
for v in &self.predefined_condition_publication_reference { v.write(w, "cz:predefinedConditionPublicationReference", "", " targetClass=\"tro:PredefinedConditionPublication\"")?; }
match &self.header_information {
Some(v) => { v.write(w, "cz:headerInformation", "", "")?; }
None => return Err(w.missing("cz:headerInformation")),
}
for v in &self.activation_status { v.write(w, "cz:activationStatus")?; }
if let Some(v) = &self.dynamic_activation_status_publication_extension { w.extension("cz:_dynamicActivationStatusPublicationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NonCodableCondition {
pub negate: Option<com::Boolean>,
pub active: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub condition: Option<MultilingualString>,
pub r#type: Option<ConditionTypeEnum>,
pub non_codable_condition_extension: Option<Box<Extension>>,
}
impl NonCodableCondition {
const FIELDS: &'static [u32] = &[0x110955, 0x110683, 0x1108c2, 0x110442, 0x50731, 0x50bfe, 0x504fe];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50119);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x110955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0x110683 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 1667); }
0x1108c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0x110442 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1090); }
0x50731 => { let v = r.multilingual()?; r.set(&mut e4, v, 1841); }
0x50bfe => { let v = r.enumeration::<ConditionTypeEnum>()?; r.set(&mut e5, v, 3070); }
0x504fe => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1278); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e5, 3070);
let v = Self {
negate: e0,
active: e1,
legal_basis: e2,
condition_extension: e3,
condition: e4,
r#type: e5,
non_codable_condition_extension: e6,
};
r.close();
Ok(v)
}
}
impl NonCodableCondition {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.negate { w.leaf("tro:negate", v)?; }
if let Some(v) = &self.active { w.leaf("tro:active", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "tro:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("tro:_conditionExtension", v)?; }
if let Some(v) = &self.condition { w.multilingual("cz:condition", v)?; }
match &self.r#type {
Some(v) => { w.enumeration("cz:type", v.literal())?; }
None => return Err(w.missing("cz:type")),
}
if let Some(v) = &self.non_codable_condition_extension { w.extension("cz:_nonCodableConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NonPredefinedConditionActivation {
pub id: Option<String>,
pub version: Option<String>,
pub activation_time: Option<DateTime>,
pub activation_version_time: Option<DateTime>,
pub validity: Option<Box<com::Validity>>,
pub activation_status_extension: Option<Box<Extension>>,
pub controlled_zone_reference: Option<Box<com::VersionedReference>>,
pub condition: Option<tro::Condition>,
pub non_predefined_condition_activation_extension: Option<Box<Extension>>,
}
impl NonPredefinedConditionActivation {
const FIELDS: &'static [u32] = &[0x5067f, 0x50682, 0x50c26, 0x503ff, 0x5073d, 0x50731, 0x50501];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5011c);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x5067f => { let v = r.date_time()?; r.set(&mut e0, v, 1663); }
0x50682 => { let v = r.date_time()?; r.set(&mut e1, v, 1666); }
0x50c26 => { let v = Some(com::Validity::read(r)?); r.set(&mut e2, v.map(Box::new), 3110); }
0x503ff => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1023); }
0x5073d => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 1853); }
0x50731 => { let v = tro::Condition::read(r)?; r.set(&mut e5, v, 1841); }
0x50501 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1281); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1663);
r.required(&e1, 1666);
r.required(&e2, 3110);
r.required(&e4, 1853);
r.required(&e5, 1841);
let v = Self {
id: a0,
version: a1,
activation_time: e0,
activation_version_time: e1,
validity: e2,
activation_status_extension: e3,
controlled_zone_reference: e4,
condition: e5,
non_predefined_condition_activation_extension: e6,
};
r.close();
Ok(v)
}
}
impl NonPredefinedConditionActivation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
match &self.activation_time {
Some(v) => { w.leaf("cz:activationTime", v)?; }
None => return Err(w.missing("cz:activationTime")),
}
match &self.activation_version_time {
Some(v) => { w.leaf("cz:activationVersionTime", v)?; }
None => return Err(w.missing("cz:activationVersionTime")),
}
match &self.validity {
Some(v) => { v.write(w, "cz:validity", "", "")?; }
None => return Err(w.missing("cz:validity")),
}
if let Some(v) = &self.activation_status_extension { w.extension("cz:_activationStatusExtension", v)?; }
match &self.controlled_zone_reference {
Some(v) => { v.write(w, "cz:controlledZoneReference", "", " targetClass=\"cz:ControlledZone\"")?; }
None => return Err(w.missing("cz:controlledZoneReference")),
}
match &self.condition {
Some(v) => { v.write(w, "cz:condition")?; }
None => return Err(w.missing("cz:condition")),
}
if let Some(v) = &self.non_predefined_condition_activation_extension { w.extension("cz:_nonPredefinedConditionActivationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Penalty {
pub amount_due: Option<tro::AmountOfMoney>,
pub penalty_description: Option<MultilingualString>,
pub penalty_extension: Option<Box<Extension>>,
}
impl Penalty {
const FIELDS: &'static [u32] = &[0x506b9, 0x50a18, 0x5054c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50168);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x506b9 => { let v = r.value::<Decimal>()?; r.set(&mut e0, v, 1721); }
0x50a18 => { let v = r.multilingual()?; r.set(&mut e1, v, 2584); }
0x5054c => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1356); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1721);
let v = Self {
amount_due: e0,
penalty_description: e1,
penalty_extension: e2,
};
r.close();
Ok(v)
}
}
impl Penalty {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.amount_due {
Some(v) => { w.digits("amountDue", v, 8, 2)?; w.leaf("cz:amountDue", v)?; }
None => return Err(w.missing("cz:amountDue")),
}
if let Some(v) = &self.penalty_description { w.multilingual("cz:penaltyDescription", v)?; }
if let Some(v) = &self.penalty_extension { w.extension("cz:_penaltyExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PeriodCondition {
pub negate: Option<com::Boolean>,
pub active: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub period: Vec<com::Period>,
pub period_condition_extension: Option<Box<Extension>>,
}
impl PeriodCondition {
const FIELDS: &'static [u32] = &[0x110955, 0x110683, 0x1108c2, 0x110442, 0x50a1c, 0x5054f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5016c);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x110955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0x110683 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 1667); }
0x1108c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0x110442 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1090); }
0x50a1c => { let v = Some(com::Period::read(r)?); e4.extend(v); }
0x5054f => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1359); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
negate: e0,
active: e1,
legal_basis: e2,
condition_extension: e3,
period: e4,
period_condition_extension: e5,
};
r.close();
Ok(v)
}
}
impl PeriodCondition {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.negate { w.leaf("tro:negate", v)?; }
if let Some(v) = &self.active { w.leaf("tro:active", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "tro:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("tro:_conditionExtension", v)?; }
w.count("cz:period", self.period.len(), 1, usize::MAX)?;
for v in &self.period { v.write(w, "cz:period", "", "")?; }
if let Some(v) = &self.period_condition_extension { w.extension("cz:_periodConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PredefinedConditionActivation {
pub id: Option<String>,
pub version: Option<String>,
pub activation_time: Option<DateTime>,
pub activation_version_time: Option<DateTime>,
pub validity: Option<Box<com::Validity>>,
pub activation_status_extension: Option<Box<Extension>>,
pub controlled_zone_reference: Option<Box<com::VersionedReference>>,
pub predefined_condition_reference: Option<Box<com::VersionedReference>>,
pub predefined_condition_activation_extension: Option<Box<Extension>>,
}
impl PredefinedConditionActivation {
const FIELDS: &'static [u32] = &[0x5067f, 0x50682, 0x50c26, 0x503ff, 0x5073d, 0x50a60, 0x5056e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x5018c);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x5067f => { let v = r.date_time()?; r.set(&mut e0, v, 1663); }
0x50682 => { let v = r.date_time()?; r.set(&mut e1, v, 1666); }
0x50c26 => { let v = Some(com::Validity::read(r)?); r.set(&mut e2, v.map(Box::new), 3110); }
0x503ff => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1023); }
0x5073d => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 1853); }
0x50a60 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e5, v.map(Box::new), 2656); }
0x5056e => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1390); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1663);
r.required(&e1, 1666);
r.required(&e2, 3110);
r.required(&e4, 1853);
r.required(&e5, 2656);
let v = Self {
id: a0,
version: a1,
activation_time: e0,
activation_version_time: e1,
validity: e2,
activation_status_extension: e3,
controlled_zone_reference: e4,
predefined_condition_reference: e5,
predefined_condition_activation_extension: e6,
};
r.close();
Ok(v)
}
}
impl PredefinedConditionActivation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
match &self.activation_time {
Some(v) => { w.leaf("cz:activationTime", v)?; }
None => return Err(w.missing("cz:activationTime")),
}
match &self.activation_version_time {
Some(v) => { w.leaf("cz:activationVersionTime", v)?; }
None => return Err(w.missing("cz:activationVersionTime")),
}
match &self.validity {
Some(v) => { v.write(w, "cz:validity", "", "")?; }
None => return Err(w.missing("cz:validity")),
}
if let Some(v) = &self.activation_status_extension { w.extension("cz:_activationStatusExtension", v)?; }
match &self.controlled_zone_reference {
Some(v) => { v.write(w, "cz:controlledZoneReference", "", " targetClass=\"cz:ControlledZone\"")?; }
None => return Err(w.missing("cz:controlledZoneReference")),
}
match &self.predefined_condition_reference {
Some(v) => { v.write(w, "cz:predefinedConditionReference", "", " targetClass=\"tro:PredefinedCondition\"")?; }
None => return Err(w.missing("cz:predefinedConditionReference")),
}
if let Some(v) = &self.predefined_condition_activation_extension { w.extension("cz:_predefinedConditionActivationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RetrofittingCondition {
pub negate: Option<com::Boolean>,
pub active: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub retrofitting_possible: Option<com::Boolean>,
pub url_for_further_information: Option<com::Url>,
pub retrofitting_condition_extension: Option<Box<Extension>>,
}
impl RetrofittingCondition {
const FIELDS: &'static [u32] = &[0x110955, 0x110683, 0x1108c2, 0x110442, 0x50af0, 0x50c0f, 0x5059f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x501be);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x110955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0x110683 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 1667); }
0x1108c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0x110442 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1090); }
0x50af0 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2800); }
0x50c0f => { let v = r.string()?; r.set(&mut e5, v, 3087); }
0x5059f => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1439); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2800);
let v = Self {
negate: e0,
active: e1,
legal_basis: e2,
condition_extension: e3,
retrofitting_possible: e4,
url_for_further_information: e5,
retrofitting_condition_extension: e6,
};
r.close();
Ok(v)
}
}
impl RetrofittingCondition {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.negate { w.leaf("tro:negate", v)?; }
if let Some(v) = &self.active { w.leaf("tro:active", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "tro:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("tro:_conditionExtension", v)?; }
match &self.retrofitting_possible {
Some(v) => { w.leaf("cz:retrofittingPossible", v)?; }
None => return Err(w.missing("cz:retrofittingPossible")),
}
if let Some(v) = &self.url_for_further_information { w.leaf("cz:urlForFurtherInformation", v)?; }
if let Some(v) = &self.retrofitting_condition_extension { w.extension("cz:_retrofittingConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TariffCondition {
pub negate: Option<com::Boolean>,
pub active: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub tariff_paid: Option<com::Boolean>,
pub tariff_condition_extension: Option<Box<Extension>>,
}
impl TariffCondition {
const FIELDS: &'static [u32] = &[0x110955, 0x110683, 0x1108c2, 0x110442, 0x50ba0, 0x505e7];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50209);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x110955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0x110683 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 1667); }
0x1108c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0x110442 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1090); }
0x50ba0 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2976); }
0x505e7 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1511); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2976);
let v = Self {
negate: e0,
active: e1,
legal_basis: e2,
condition_extension: e3,
tariff_paid: e4,
tariff_condition_extension: e5,
};
r.close();
Ok(v)
}
}
impl TariffCondition {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.negate { w.leaf("tro:negate", v)?; }
if let Some(v) = &self.active { w.leaf("tro:active", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "tro:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("tro:_conditionExtension", v)?; }
match &self.tariff_paid {
Some(v) => { w.leaf("cz:tariffPaid", v)?; }
None => return Err(w.missing("cz:tariffPaid")),
}
if let Some(v) = &self.tariff_condition_extension { w.extension("cz:_tariffConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TrafficRegulationActivation {
pub id: Option<String>,
pub version: Option<String>,
pub activation_time: Option<DateTime>,
pub activation_version_time: Option<DateTime>,
pub validity: Option<Box<com::Validity>>,
pub activation_status_extension: Option<Box<Extension>>,
pub traffic_regulation_reference: Option<Box<com::VersionedReference>>,
pub traffic_regulation_activation_extension: Option<Box<Extension>>,
}
impl TrafficRegulationActivation {
const FIELDS: &'static [u32] = &[0x5067f, 0x50682, 0x50c26, 0x503ff, 0x50be2, 0x50616];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x50239);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x5067f => { let v = r.date_time()?; r.set(&mut e0, v, 1663); }
0x50682 => { let v = r.date_time()?; r.set(&mut e1, v, 1666); }
0x50c26 => { let v = Some(com::Validity::read(r)?); r.set(&mut e2, v.map(Box::new), 3110); }
0x503ff => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1023); }
0x50be2 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 3042); }
0x50616 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1558); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1663);
r.required(&e1, 1666);
r.required(&e2, 3110);
r.required(&e4, 3042);
let v = Self {
id: a0,
version: a1,
activation_time: e0,
activation_version_time: e1,
validity: e2,
activation_status_extension: e3,
traffic_regulation_reference: e4,
traffic_regulation_activation_extension: e5,
};
r.close();
Ok(v)
}
}
impl TrafficRegulationActivation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
match &self.activation_time {
Some(v) => { w.leaf("cz:activationTime", v)?; }
None => return Err(w.missing("cz:activationTime")),
}
match &self.activation_version_time {
Some(v) => { w.leaf("cz:activationVersionTime", v)?; }
None => return Err(w.missing("cz:activationVersionTime")),
}
match &self.validity {
Some(v) => { v.write(w, "cz:validity", "", "")?; }
None => return Err(w.missing("cz:validity")),
}
if let Some(v) = &self.activation_status_extension { w.extension("cz:_activationStatusExtension", v)?; }
match &self.traffic_regulation_reference {
Some(v) => { v.write(w, "cz:trafficRegulationReference", "", " targetClass=\"tro:TrafficRegulation\"")?; }
None => return Err(w.missing("cz:trafficRegulationReference")),
}
if let Some(v) = &self.traffic_regulation_activation_extension { w.extension("cz:_trafficRegulationActivationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ActivationStatus {
ControlledZoneActivation(Box<ControlledZoneActivation>),
NonPredefinedConditionActivation(Box<NonPredefinedConditionActivation>),
PredefinedConditionActivation(Box<PredefinedConditionActivation>),
TrafficRegulationActivation(Box<TrafficRegulationActivation>),
}
impl ActivationStatus {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0x5005f) => Self::ControlledZoneActivation(Box::new(ControlledZoneActivation::read(r)?)),
Some(0x5011c) => Self::NonPredefinedConditionActivation(Box::new(NonPredefinedConditionActivation::read(r)?)),
Some(0x5018c) => Self::PredefinedConditionActivation(Box::new(PredefinedConditionActivation::read(r)?)),
Some(0x50239) => Self::TrafficRegulationActivation(Box::new(TrafficRegulationActivation::read(r)?)),
_ => {
r.unknown_type("ActivationStatus")?;
return Ok(None);
}
}))
}
pub fn id(&self) -> Option<&str> {
match self {
Self::ControlledZoneActivation(v) => v.id.as_deref(),
Self::NonPredefinedConditionActivation(v) => v.id.as_deref(),
Self::PredefinedConditionActivation(v) => v.id.as_deref(),
Self::TrafficRegulationActivation(v) => v.id.as_deref(),
}
}
pub fn version(&self) -> Option<&str> {
match self {
Self::ControlledZoneActivation(v) => v.version.as_deref(),
Self::NonPredefinedConditionActivation(v) => v.version.as_deref(),
Self::PredefinedConditionActivation(v) => v.version.as_deref(),
Self::TrafficRegulationActivation(v) => v.version.as_deref(),
}
}
pub fn activation_time(&self) -> Option<&DateTime> {
match self {
Self::ControlledZoneActivation(v) => v.activation_time.as_ref(),
Self::NonPredefinedConditionActivation(v) => v.activation_time.as_ref(),
Self::PredefinedConditionActivation(v) => v.activation_time.as_ref(),
Self::TrafficRegulationActivation(v) => v.activation_time.as_ref(),
}
}
pub fn activation_version_time(&self) -> Option<&DateTime> {
match self {
Self::ControlledZoneActivation(v) => v.activation_version_time.as_ref(),
Self::NonPredefinedConditionActivation(v) => v.activation_version_time.as_ref(),
Self::PredefinedConditionActivation(v) => v.activation_version_time.as_ref(),
Self::TrafficRegulationActivation(v) => v.activation_version_time.as_ref(),
}
}
pub fn validity(&self) -> Option<&com::Validity> {
match self {
Self::ControlledZoneActivation(v) => v.validity.as_deref(),
Self::NonPredefinedConditionActivation(v) => v.validity.as_deref(),
Self::PredefinedConditionActivation(v) => v.validity.as_deref(),
Self::TrafficRegulationActivation(v) => v.validity.as_deref(),
}
}
pub fn activation_status_extension(&self) -> Option<&Extension> {
match self {
Self::ControlledZoneActivation(v) => v.activation_status_extension.as_deref(),
Self::NonPredefinedConditionActivation(v) => v.activation_status_extension.as_deref(),
Self::PredefinedConditionActivation(v) => v.activation_status_extension.as_deref(),
Self::TrafficRegulationActivation(v) => v.activation_status_extension.as_deref(),
}
}
}
impl ActivationStatus {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::ControlledZoneActivation(v) => v.write(w, tag, " xsi:type=\"cz:ControlledZoneActivation\"", ""),
Self::NonPredefinedConditionActivation(v) => v.write(w, tag, " xsi:type=\"cz:NonPredefinedConditionActivation\"", ""),
Self::PredefinedConditionActivation(v) => v.write(w, tag, " xsi:type=\"cz:PredefinedConditionActivation\"", ""),
Self::TrafficRegulationActivation(v) => v.write(w, tag, " xsi:type=\"cz:TrafficRegulationActivation\"", ""),
}
}
}