// @generated by `cargo xtask codegen` from the DATEX II 3.7 schemas. Do not edit.
//! Types of the DATEX II namespace `http://datex2.eu/schema/3/afirFacilities`.
//!
//! Names follow the standard; see <https://docs.datex2.eu/> for what each one means.
#[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, traffic_regulation as tro, controlled_zone as cz, traffic_management_plan as tmp, rerouting_management_enhanced as rer, urban_extensions as ubx, fault_and_status as fst, message_container as con, exchange_information as ex, information_management as inf, cis_information as cis};
#[allow(unused_imports)]
use crate::out::{Out, Pattern, Rules};
#[allow(unused_imports)]
use crate::json::{JsonReader, JsonWriter};
#[allow(unused_imports)]
use crate::{ErrorKind, WarningKind};
#[allow(unused_imports)]
use crate::xml::{Enumeration, Xml};
#[allow(unused_imports)]
use crate::{Date, DateTime, Decimal, Error, Extension, MultilingualString, Time};
/// XML enumeration `afac:AccessibilityEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AccessibilityEnum {
/// `barrierFreeAccessible`
BarrierFreeAccessible,
/// `disabilityAccessible`
DisabilityAccessible,
/// `wheelChairAccessible`
WheelChairAccessible,
/// `disabilityFacilities`
DisabilityFacilities,
/// `orientationSystemForBlindPeople`
OrientationSystemForBlindPeople,
/// `marking`
Marking,
/// `none`
None,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl AccessibilityEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::BarrierFreeAccessible => "barrierFreeAccessible",
Self::DisabilityAccessible => "disabilityAccessible",
Self::WheelChairAccessible => "wheelChairAccessible",
Self::DisabilityFacilities => "disabilityFacilities",
Self::OrientationSystemForBlindPeople => "orientationSystemForBlindPeople",
Self::Marking => "marking",
Self::None => "none",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for AccessibilityEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"barrierFreeAccessible" => Some(Self::BarrierFreeAccessible),
"disabilityAccessible" => Some(Self::DisabilityAccessible),
"wheelChairAccessible" => Some(Self::WheelChairAccessible),
"disabilityFacilities" => Some(Self::DisabilityFacilities),
"orientationSystemForBlindPeople" => Some(Self::OrientationSystemForBlindPeople),
"marking" => Some(Self::Marking),
"none" => Some(Self::None),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl AccessibilityEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `afac:AmountOfMoney`.
pub type AmountOfMoney = Decimal;
/// XML enumeration `afac:AvailabilityEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AvailabilityEnum {
/// `available`
Available,
/// `notAvailable`
NotAvailable,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl AvailabilityEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Available => "available",
Self::NotAvailable => "notAvailable",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for AvailabilityEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"available" => Some(Self::Available),
"notAvailable" => Some(Self::NotAvailable),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl AvailabilityEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:CredentialTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CredentialTypeEnum {
/// `hangtag`
Hangtag,
/// `permit`
Permit,
/// `licensePlate`
LicensePlate,
/// `ticket`
Ticket,
/// `eticket`
Eticket,
/// `barcode`
Barcode,
/// `bluetooth`
Bluetooth,
/// `rfid`
Rfid,
/// `qrCode`
QrCode,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl CredentialTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Hangtag => "hangtag",
Self::Permit => "permit",
Self::LicensePlate => "licensePlate",
Self::Ticket => "ticket",
Self::Eticket => "eticket",
Self::Barcode => "barcode",
Self::Bluetooth => "bluetooth",
Self::Rfid => "rfid",
Self::QrCode => "qrCode",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for CredentialTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"hangtag" => Some(Self::Hangtag),
"permit" => Some(Self::Permit),
"licensePlate" => Some(Self::LicensePlate),
"ticket" => Some(Self::Ticket),
"eticket" => Some(Self::Eticket),
"barcode" => Some(Self::Barcode),
"bluetooth" => Some(Self::Bluetooth),
"rfid" => Some(Self::Rfid),
"qrCode" => Some(Self::QrCode),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl CredentialTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `afac:CurrencyCode`.
pub type CurrencyCode = String;
/// XML simple type `afac:Duration`.
pub type Duration = String;
/// XML enumeration `afac:EnergySourceEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EnergySourceEnum {
/// `all`
All,
/// `battery`
Battery,
/// `biodiesel`
Biodiesel,
/// `diesel`
Diesel,
/// `dieselBatteryHybrid`
DieselBatteryHybrid,
/// `ethanol`
Ethanol,
/// `hydrogen`
Hydrogen,
/// `liquidGas`
LiquidGas,
/// `lpg`
Lpg,
/// `methane`
Methane,
/// `petrol`
Petrol,
/// `petrol95Octane`
Petrol95Octane,
/// `petrol98Octane`
Petrol98Octane,
/// `petrolBatteryHybrid`
PetrolBatteryHybrid,
/// `petrolLeaded`
PetrolLeaded,
/// `petrolUnleaded`
PetrolUnleaded,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl EnergySourceEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Battery => "battery",
Self::Biodiesel => "biodiesel",
Self::Diesel => "diesel",
Self::DieselBatteryHybrid => "dieselBatteryHybrid",
Self::Ethanol => "ethanol",
Self::Hydrogen => "hydrogen",
Self::LiquidGas => "liquidGas",
Self::Lpg => "lpg",
Self::Methane => "methane",
Self::Petrol => "petrol",
Self::Petrol95Octane => "petrol95Octane",
Self::Petrol98Octane => "petrol98Octane",
Self::PetrolBatteryHybrid => "petrolBatteryHybrid",
Self::PetrolLeaded => "petrolLeaded",
Self::PetrolUnleaded => "petrolUnleaded",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EnergySourceEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"all" => Some(Self::All),
"battery" => Some(Self::Battery),
"biodiesel" => Some(Self::Biodiesel),
"diesel" => Some(Self::Diesel),
"dieselBatteryHybrid" => Some(Self::DieselBatteryHybrid),
"ethanol" => Some(Self::Ethanol),
"hydrogen" => Some(Self::Hydrogen),
"liquidGas" => Some(Self::LiquidGas),
"lpg" => Some(Self::Lpg),
"methane" => Some(Self::Methane),
"petrol" => Some(Self::Petrol),
"petrol95Octane" => Some(Self::Petrol95Octane),
"petrol98Octane" => Some(Self::Petrol98Octane),
"petrolBatteryHybrid" => Some(Self::PetrolBatteryHybrid),
"petrolLeaded" => Some(Self::PetrolLeaded),
"petrolUnleaded" => Some(Self::PetrolUnleaded),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EnergySourceEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:EquipmentTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EquipmentTypeEnum {
/// `bathRoom`
BathRoom,
/// `bikeParking`
BikeParking,
/// `cashMachine`
CashMachine,
/// `copyMachineOrService`
CopyMachineOrService,
/// `defibrillator`
Defibrillator,
/// `dsrcReceiver`
DsrcReceiver,
/// `dumpingStation`
DumpingStation,
/// `electricChargingStation`
ElectricChargingStation,
/// `elevator`
Elevator,
/// `faxMachineOrService`
FaxMachineOrService,
/// `fireExtinguisher`
FireExtinguisher,
/// `fireHose`
FireHose,
/// `fireHydrant`
FireHydrant,
/// `firstAidEquipment`
FirstAidEquipment,
/// `iceFreeScaffold`
IceFreeScaffold,
/// `informationPoint`
InformationPoint,
/// `informationStele`
InformationStele,
/// `internetTerminal`
InternetTerminal,
/// `internetWireless`
InternetWireless,
/// `luggageLocker`
LuggageLocker,
/// `paymentMachine`
PaymentMachine,
/// `picnicFacilities`
PicnicFacilities,
/// `playground`
Playground,
/// `publicCardPhone`
PublicCardPhone,
/// `publicCoinPhone`
PublicCoinPhone,
/// `publicPhone`
PublicPhone,
/// `refuseBin`
RefuseBin,
/// `restingFacilities`
RestingFacilities,
/// `safeDeposit`
SafeDeposit,
/// `shelter`
Shelter,
/// `shower`
Shower,
/// `snowAndIceRemovalEquipment`
SnowAndIceRemovalEquipment,
/// `toilet`
Toilet,
/// `tollTerminal`
TollTerminal,
/// `tyreAirPressureEquipment`
TyreAirPressureEquipment,
/// `waterBasin`
WaterBasin,
/// `vendingMachine`
VendingMachine,
/// `waterSupply`
WaterSupply,
/// `wasteDisposal`
WasteDisposal,
/// `waterTap`
WaterTap,
/// `none`
None,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl EquipmentTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::BathRoom => "bathRoom",
Self::BikeParking => "bikeParking",
Self::CashMachine => "cashMachine",
Self::CopyMachineOrService => "copyMachineOrService",
Self::Defibrillator => "defibrillator",
Self::DsrcReceiver => "dsrcReceiver",
Self::DumpingStation => "dumpingStation",
Self::ElectricChargingStation => "electricChargingStation",
Self::Elevator => "elevator",
Self::FaxMachineOrService => "faxMachineOrService",
Self::FireExtinguisher => "fireExtinguisher",
Self::FireHose => "fireHose",
Self::FireHydrant => "fireHydrant",
Self::FirstAidEquipment => "firstAidEquipment",
Self::IceFreeScaffold => "iceFreeScaffold",
Self::InformationPoint => "informationPoint",
Self::InformationStele => "informationStele",
Self::InternetTerminal => "internetTerminal",
Self::InternetWireless => "internetWireless",
Self::LuggageLocker => "luggageLocker",
Self::PaymentMachine => "paymentMachine",
Self::PicnicFacilities => "picnicFacilities",
Self::Playground => "playground",
Self::PublicCardPhone => "publicCardPhone",
Self::PublicCoinPhone => "publicCoinPhone",
Self::PublicPhone => "publicPhone",
Self::RefuseBin => "refuseBin",
Self::RestingFacilities => "restingFacilities",
Self::SafeDeposit => "safeDeposit",
Self::Shelter => "shelter",
Self::Shower => "shower",
Self::SnowAndIceRemovalEquipment => "snowAndIceRemovalEquipment",
Self::Toilet => "toilet",
Self::TollTerminal => "tollTerminal",
Self::TyreAirPressureEquipment => "tyreAirPressureEquipment",
Self::WaterBasin => "waterBasin",
Self::VendingMachine => "vendingMachine",
Self::WaterSupply => "waterSupply",
Self::WasteDisposal => "wasteDisposal",
Self::WaterTap => "waterTap",
Self::None => "none",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EquipmentTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"bathRoom" => Some(Self::BathRoom),
"bikeParking" => Some(Self::BikeParking),
"cashMachine" => Some(Self::CashMachine),
"copyMachineOrService" => Some(Self::CopyMachineOrService),
"defibrillator" => Some(Self::Defibrillator),
"dsrcReceiver" => Some(Self::DsrcReceiver),
"dumpingStation" => Some(Self::DumpingStation),
"electricChargingStation" => Some(Self::ElectricChargingStation),
"elevator" => Some(Self::Elevator),
"faxMachineOrService" => Some(Self::FaxMachineOrService),
"fireExtinguisher" => Some(Self::FireExtinguisher),
"fireHose" => Some(Self::FireHose),
"fireHydrant" => Some(Self::FireHydrant),
"firstAidEquipment" => Some(Self::FirstAidEquipment),
"iceFreeScaffold" => Some(Self::IceFreeScaffold),
"informationPoint" => Some(Self::InformationPoint),
"informationStele" => Some(Self::InformationStele),
"internetTerminal" => Some(Self::InternetTerminal),
"internetWireless" => Some(Self::InternetWireless),
"luggageLocker" => Some(Self::LuggageLocker),
"paymentMachine" => Some(Self::PaymentMachine),
"picnicFacilities" => Some(Self::PicnicFacilities),
"playground" => Some(Self::Playground),
"publicCardPhone" => Some(Self::PublicCardPhone),
"publicCoinPhone" => Some(Self::PublicCoinPhone),
"publicPhone" => Some(Self::PublicPhone),
"refuseBin" => Some(Self::RefuseBin),
"restingFacilities" => Some(Self::RestingFacilities),
"safeDeposit" => Some(Self::SafeDeposit),
"shelter" => Some(Self::Shelter),
"shower" => Some(Self::Shower),
"snowAndIceRemovalEquipment" => Some(Self::SnowAndIceRemovalEquipment),
"toilet" => Some(Self::Toilet),
"tollTerminal" => Some(Self::TollTerminal),
"tyreAirPressureEquipment" => Some(Self::TyreAirPressureEquipment),
"waterBasin" => Some(Self::WaterBasin),
"vendingMachine" => Some(Self::VendingMachine),
"waterSupply" => Some(Self::WaterSupply),
"wasteDisposal" => Some(Self::WasteDisposal),
"waterTap" => Some(Self::WaterTap),
"none" => Some(Self::None),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EquipmentTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:FacilityTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FacilityTypeEnum {
/// `airport`
Airport,
/// `carPark`
CarPark,
/// `carRentalStation`
CarRentalStation,
/// `electricChargingStation`
ElectricChargingStation,
/// `energyInfrastructureSite`
EnergyInfrastructureSite,
/// `lorryParkingSite`
LorryParkingSite,
/// `parkingSite`
ParkingSite,
/// `petrolStation`
PetrolStation,
/// `publicTransportDepot`
PublicTransportDepot,
/// `publicTransportHub`
PublicTransportHub,
/// `shoppingCentre`
ShoppingCentre,
/// `trainStation`
TrainStation,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl FacilityTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Airport => "airport",
Self::CarPark => "carPark",
Self::CarRentalStation => "carRentalStation",
Self::ElectricChargingStation => "electricChargingStation",
Self::EnergyInfrastructureSite => "energyInfrastructureSite",
Self::LorryParkingSite => "lorryParkingSite",
Self::ParkingSite => "parkingSite",
Self::PetrolStation => "petrolStation",
Self::PublicTransportDepot => "publicTransportDepot",
Self::PublicTransportHub => "publicTransportHub",
Self::ShoppingCentre => "shoppingCentre",
Self::TrainStation => "trainStation",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for FacilityTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"airport" => Some(Self::Airport),
"carPark" => Some(Self::CarPark),
"carRentalStation" => Some(Self::CarRentalStation),
"electricChargingStation" => Some(Self::ElectricChargingStation),
"energyInfrastructureSite" => Some(Self::EnergyInfrastructureSite),
"lorryParkingSite" => Some(Self::LorryParkingSite),
"parkingSite" => Some(Self::ParkingSite),
"petrolStation" => Some(Self::PetrolStation),
"publicTransportDepot" => Some(Self::PublicTransportDepot),
"publicTransportHub" => Some(Self::PublicTransportHub),
"shoppingCentre" => Some(Self::ShoppingCentre),
"trainStation" => Some(Self::TrainStation),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl FacilityTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:ImageFormatEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ImageFormatEnum {
/// `bmp`
Bmp,
/// `gif`
Gif,
/// `jpeg`
Jpeg,
/// `png`
Png,
/// A value outside the standard list.
Extended(String),
}
impl ImageFormatEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Bmp => "bmp",
Self::Gif => "gif",
Self::Jpeg => "jpeg",
Self::Png => "png",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ImageFormatEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"bmp" => Some(Self::Bmp),
"gif" => Some(Self::Gif),
"jpeg" => Some(Self::Jpeg),
"png" => Some(Self::Png),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ImageFormatEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:MeansOfPaymentEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum MeansOfPaymentEnum {
/// `paymentCreditCard`
PaymentCreditCard,
/// `cashBillsOnly`
CashBillsOnly,
/// `cashCoinsOnly`
CashCoinsOnly,
/// `tollTag`
TollTag,
/// `mobileAccount`
MobileAccount,
/// `cashCoinsAndBills`
CashCoinsAndBills,
/// `prepay`
Prepay,
/// `paymentDebitCard`
PaymentDebitCard,
/// `paymentValueCard`
PaymentValueCard,
/// `nfc`
Nfc,
/// `emv`
Emv,
/// `qrCode`
QrCode,
/// `website`
Website,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl MeansOfPaymentEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::PaymentCreditCard => "paymentCreditCard",
Self::CashBillsOnly => "cashBillsOnly",
Self::CashCoinsOnly => "cashCoinsOnly",
Self::TollTag => "tollTag",
Self::MobileAccount => "mobileAccount",
Self::CashCoinsAndBills => "cashCoinsAndBills",
Self::Prepay => "prepay",
Self::PaymentDebitCard => "paymentDebitCard",
Self::PaymentValueCard => "paymentValueCard",
Self::Nfc => "nfc",
Self::Emv => "emv",
Self::QrCode => "qrCode",
Self::Website => "website",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for MeansOfPaymentEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"paymentCreditCard" => Some(Self::PaymentCreditCard),
"cashBillsOnly" => Some(Self::CashBillsOnly),
"cashCoinsOnly" => Some(Self::CashCoinsOnly),
"tollTag" => Some(Self::TollTag),
"mobileAccount" => Some(Self::MobileAccount),
"cashCoinsAndBills" => Some(Self::CashCoinsAndBills),
"prepay" => Some(Self::Prepay),
"paymentDebitCard" => Some(Self::PaymentDebitCard),
"paymentValueCard" => Some(Self::PaymentValueCard),
"nfc" => Some(Self::Nfc),
"emv" => Some(Self::Emv),
"qrCode" => Some(Self::QrCode),
"website" => Some(Self::Website),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl MeansOfPaymentEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:OpeningStatusEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OpeningStatusEnum {
/// `open`
Open,
/// `openWithServiceLimitation`
OpenWithServiceLimitation,
/// `closed`
Closed,
/// `closedOnHoliday`
ClosedOnHoliday,
/// `closedOnMaintenance`
ClosedOnMaintenance,
/// `temporarilyClosed`
TemporarilyClosed,
/// `statusUnknown`
StatusUnknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl OpeningStatusEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Open => "open",
Self::OpenWithServiceLimitation => "openWithServiceLimitation",
Self::Closed => "closed",
Self::ClosedOnHoliday => "closedOnHoliday",
Self::ClosedOnMaintenance => "closedOnMaintenance",
Self::TemporarilyClosed => "temporarilyClosed",
Self::StatusUnknown => "statusUnknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OpeningStatusEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"open" => Some(Self::Open),
"openWithServiceLimitation" => Some(Self::OpenWithServiceLimitation),
"closed" => Some(Self::Closed),
"closedOnHoliday" => Some(Self::ClosedOnHoliday),
"closedOnMaintenance" => Some(Self::ClosedOnMaintenance),
"temporarilyClosed" => Some(Self::TemporarilyClosed),
"statusUnknown" => Some(Self::StatusUnknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OpeningStatusEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:OperationStatusEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OperationStatusEnum {
/// `inOperation`
InOperation,
/// `limitedOperation`
LimitedOperation,
/// `notInOperation`
NotInOperation,
/// `notInOperationAbnormal`
NotInOperationAbnormal,
/// `technicalDefect`
TechnicalDefect,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl OperationStatusEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::InOperation => "inOperation",
Self::LimitedOperation => "limitedOperation",
Self::NotInOperation => "notInOperation",
Self::NotInOperationAbnormal => "notInOperationAbnormal",
Self::TechnicalDefect => "technicalDefect",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OperationStatusEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"inOperation" => Some(Self::InOperation),
"limitedOperation" => Some(Self::LimitedOperation),
"notInOperation" => Some(Self::NotInOperation),
"notInOperationAbnormal" => Some(Self::NotInOperationAbnormal),
"technicalDefect" => Some(Self::TechnicalDefect),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OperationStatusEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:OrganisationTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OrganisationTypeEnum {
/// `publicSector`
PublicSector,
/// `privateSector`
PrivateSector,
/// A value outside the standard list.
Extended(String),
}
impl OrganisationTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::PublicSector => "publicSector",
Self::PrivateSector => "privateSector",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OrganisationTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"publicSector" => Some(Self::PublicSector),
"privateSector" => Some(Self::PrivateSector),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OrganisationTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:PaymentBrandsEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PaymentBrandsEnum {
/// `americanExpress`
AmericanExpress,
/// `applePay`
ApplePay,
/// `cirrus`
Cirrus,
/// `dinersClub`
DinersClub,
/// `discoverCard`
DiscoverCard,
/// `giroCard`
GiroCard,
/// `maestro`
Maestro,
/// `masterCard`
MasterCard,
/// `visa`
Visa,
/// `vpay`
Vpay,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl PaymentBrandsEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AmericanExpress => "americanExpress",
Self::ApplePay => "applePay",
Self::Cirrus => "cirrus",
Self::DinersClub => "dinersClub",
Self::DiscoverCard => "discoverCard",
Self::GiroCard => "giroCard",
Self::Maestro => "maestro",
Self::MasterCard => "masterCard",
Self::Visa => "visa",
Self::Vpay => "vpay",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PaymentBrandsEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"americanExpress" => Some(Self::AmericanExpress),
"applePay" => Some(Self::ApplePay),
"cirrus" => Some(Self::Cirrus),
"dinersClub" => Some(Self::DinersClub),
"discoverCard" => Some(Self::DiscoverCard),
"giroCard" => Some(Self::GiroCard),
"maestro" => Some(Self::Maestro),
"masterCard" => Some(Self::MasterCard),
"visa" => Some(Self::Visa),
"vpay" => Some(Self::Vpay),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PaymentBrandsEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:PaymentModeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PaymentModeEnum {
/// `prepay`
Prepay,
/// `payOnEntry`
PayOnEntry,
/// `payPriorToExit`
PayPriorToExit,
/// `payAfterExit`
PayAfterExit,
/// `payAndExit`
PayAndExit,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl PaymentModeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Prepay => "prepay",
Self::PayOnEntry => "payOnEntry",
Self::PayPriorToExit => "payPriorToExit",
Self::PayAfterExit => "payAfterExit",
Self::PayAndExit => "payAndExit",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PaymentModeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"prepay" => Some(Self::Prepay),
"payOnEntry" => Some(Self::PayOnEntry),
"payPriorToExit" => Some(Self::PayPriorToExit),
"payAfterExit" => Some(Self::PayAfterExit),
"payAndExit" => Some(Self::PayAndExit),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PaymentModeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:RateAvailabilityTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RateAvailabilityTypeEnum {
/// `private`
Private,
/// `public`
Public,
/// `restricted`
Restricted,
/// A value outside the standard list.
Extended(String),
}
impl RateAvailabilityTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Private => "private",
Self::Public => "public",
Self::Restricted => "restricted",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RateAvailabilityTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"private" => Some(Self::Private),
"public" => Some(Self::Public),
"restricted" => Some(Self::Restricted),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RateAvailabilityTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:RateLineTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RateLineTypeEnum {
/// `flatRate`
FlatRate,
/// `incrementingRate`
IncrementingRate,
/// `flatRateTier`
FlatRateTier,
/// `perUnit`
PerUnit,
/// A value outside the standard list.
Extended(String),
}
impl RateLineTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::FlatRate => "flatRate",
Self::IncrementingRate => "incrementingRate",
Self::FlatRateTier => "flatRateTier",
Self::PerUnit => "perUnit",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RateLineTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"flatRate" => Some(Self::FlatRate),
"incrementingRate" => Some(Self::IncrementingRate),
"flatRateTier" => Some(Self::FlatRateTier),
"perUnit" => Some(Self::PerUnit),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RateLineTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:RateLineUsageConditionsTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RateLineUsageConditionsTypeEnum {
/// `fixedDuration`
FixedDuration,
/// `fixedNumber`
FixedNumber,
/// `once`
Once,
/// `unlimited`
Unlimited,
/// A value outside the standard list.
Extended(String),
}
impl RateLineUsageConditionsTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::FixedDuration => "fixedDuration",
Self::FixedNumber => "fixedNumber",
Self::Once => "once",
Self::Unlimited => "unlimited",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RateLineUsageConditionsTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"fixedDuration" => Some(Self::FixedDuration),
"fixedNumber" => Some(Self::FixedNumber),
"once" => Some(Self::Once),
"unlimited" => Some(Self::Unlimited),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RateLineUsageConditionsTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:RateTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RateTypeEnum {
/// `contract`
Contract,
/// `daily`
Daily,
/// `event`
Event,
/// `hourly`
Hourly,
/// A value outside the standard list.
Extended(String),
}
impl RateTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Contract => "contract",
Self::Daily => "daily",
Self::Event => "event",
Self::Hourly => "hourly",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RateTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"contract" => Some(Self::Contract),
"daily" => Some(Self::Daily),
"event" => Some(Self::Event),
"hourly" => Some(Self::Hourly),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RateTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:RefundTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RefundTypeEnum {
/// `surchargeNonRefundable`
SurchargeNonRefundable,
/// `surchargePartiallyRefundable`
SurchargePartiallyRefundable,
/// `surchargeFullyRefundable`
SurchargeFullyRefundable,
/// A value outside the standard list.
Extended(String),
}
impl RefundTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::SurchargeNonRefundable => "surchargeNonRefundable",
Self::SurchargePartiallyRefundable => "surchargePartiallyRefundable",
Self::SurchargeFullyRefundable => "surchargeFullyRefundable",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RefundTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"surchargeNonRefundable" => Some(Self::SurchargeNonRefundable),
"surchargePartiallyRefundable" => Some(Self::SurchargePartiallyRefundable),
"surchargeFullyRefundable" => Some(Self::SurchargeFullyRefundable),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RefundTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:ReservationTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReservationTypeEnum {
/// `optional`
Optional,
/// `mandatory`
Mandatory,
/// `notAvailable`
NotAvailable,
/// `partly`
Partly,
/// `unknown`
Unknown,
/// `unspecified`
Unspecified,
/// A value outside the standard list.
Extended(String),
}
impl ReservationTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Optional => "optional",
Self::Mandatory => "mandatory",
Self::NotAvailable => "notAvailable",
Self::Partly => "partly",
Self::Unknown => "unknown",
Self::Unspecified => "unspecified",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ReservationTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"optional" => Some(Self::Optional),
"mandatory" => Some(Self::Mandatory),
"notAvailable" => Some(Self::NotAvailable),
"partly" => Some(Self::Partly),
"unknown" => Some(Self::Unknown),
"unspecified" => Some(Self::Unspecified),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ReservationTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:RightTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RightTypeEnum {
/// `oneTimeUseParking`
OneTimeUseParking,
/// `permitParking`
PermitParking,
/// `loadingUnloading`
LoadingUnloading,
/// `setdownPickup`
SetdownPickup,
/// `waiting`
Waiting,
/// `accessPermission`
AccessPermission,
/// `doingReservation`
DoingReservation,
/// `electricCharging`
ElectricCharging,
/// A value outside the standard list.
Extended(String),
}
impl RightTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::OneTimeUseParking => "oneTimeUseParking",
Self::PermitParking => "permitParking",
Self::LoadingUnloading => "loadingUnloading",
Self::SetdownPickup => "setdownPickup",
Self::Waiting => "waiting",
Self::AccessPermission => "accessPermission",
Self::DoingReservation => "doingReservation",
Self::ElectricCharging => "electricCharging",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RightTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"oneTimeUseParking" => Some(Self::OneTimeUseParking),
"permitParking" => Some(Self::PermitParking),
"loadingUnloading" => Some(Self::LoadingUnloading),
"setdownPickup" => Some(Self::SetdownPickup),
"waiting" => Some(Self::Waiting),
"accessPermission" => Some(Self::AccessPermission),
"doingReservation" => Some(Self::DoingReservation),
"electricCharging" => Some(Self::ElectricCharging),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RightTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:ServiceFacilityTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ServiceFacilityTypeEnum {
/// `bikeGarage`
BikeGarage,
/// `bikeSharing`
BikeSharing,
/// `cafe`
Cafe,
/// `carWash`
CarWash,
/// `cateringService`
CateringService,
/// `docstop`
Docstop,
/// `foodShopping`
FoodShopping,
/// `hotel`
Hotel,
/// `kiosk`
Kiosk,
/// `laundry`
Laundry,
/// `leisureActivities`
LeisureActivities,
/// `medicalFacility`
MedicalFacility,
/// `motel`
Motel,
/// `motorcycleGarage`
MotorcycleGarage,
/// `motorwayRestaurant`
MotorwayRestaurant,
/// `motorwayRestaurantSmall`
MotorwayRestaurantSmall,
/// `overnightAccommodation`
OvernightAccommodation,
/// `petrolStation`
PetrolStation,
/// `pharmacy`
Pharmacy,
/// `payDesk`
PayDesk,
/// `police`
Police,
/// `restaurant`
Restaurant,
/// `restaurantSelfService`
RestaurantSelfService,
/// `shop`
Shop,
/// `snackBar`
SnackBar,
/// `sparePartsShopping`
SparePartsShopping,
/// `touristInformation`
TouristInformation,
/// `truckRepair`
TruckRepair,
/// `truckWash`
TruckWash,
/// `tyreRepair`
TyreRepair,
/// `vehicleMaintenance`
VehicleMaintenance,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl ServiceFacilityTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::BikeGarage => "bikeGarage",
Self::BikeSharing => "bikeSharing",
Self::Cafe => "cafe",
Self::CarWash => "carWash",
Self::CateringService => "cateringService",
Self::Docstop => "docstop",
Self::FoodShopping => "foodShopping",
Self::Hotel => "hotel",
Self::Kiosk => "kiosk",
Self::Laundry => "laundry",
Self::LeisureActivities => "leisureActivities",
Self::MedicalFacility => "medicalFacility",
Self::Motel => "motel",
Self::MotorcycleGarage => "motorcycleGarage",
Self::MotorwayRestaurant => "motorwayRestaurant",
Self::MotorwayRestaurantSmall => "motorwayRestaurantSmall",
Self::OvernightAccommodation => "overnightAccommodation",
Self::PetrolStation => "petrolStation",
Self::Pharmacy => "pharmacy",
Self::PayDesk => "payDesk",
Self::Police => "police",
Self::Restaurant => "restaurant",
Self::RestaurantSelfService => "restaurantSelfService",
Self::Shop => "shop",
Self::SnackBar => "snackBar",
Self::SparePartsShopping => "sparePartsShopping",
Self::TouristInformation => "touristInformation",
Self::TruckRepair => "truckRepair",
Self::TruckWash => "truckWash",
Self::TyreRepair => "tyreRepair",
Self::VehicleMaintenance => "vehicleMaintenance",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ServiceFacilityTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"bikeGarage" => Some(Self::BikeGarage),
"bikeSharing" => Some(Self::BikeSharing),
"cafe" => Some(Self::Cafe),
"carWash" => Some(Self::CarWash),
"cateringService" => Some(Self::CateringService),
"docstop" => Some(Self::Docstop),
"foodShopping" => Some(Self::FoodShopping),
"hotel" => Some(Self::Hotel),
"kiosk" => Some(Self::Kiosk),
"laundry" => Some(Self::Laundry),
"leisureActivities" => Some(Self::LeisureActivities),
"medicalFacility" => Some(Self::MedicalFacility),
"motel" => Some(Self::Motel),
"motorcycleGarage" => Some(Self::MotorcycleGarage),
"motorwayRestaurant" => Some(Self::MotorwayRestaurant),
"motorwayRestaurantSmall" => Some(Self::MotorwayRestaurantSmall),
"overnightAccommodation" => Some(Self::OvernightAccommodation),
"petrolStation" => Some(Self::PetrolStation),
"pharmacy" => Some(Self::Pharmacy),
"payDesk" => Some(Self::PayDesk),
"police" => Some(Self::Police),
"restaurant" => Some(Self::Restaurant),
"restaurantSelfService" => Some(Self::RestaurantSelfService),
"shop" => Some(Self::Shop),
"snackBar" => Some(Self::SnackBar),
"sparePartsShopping" => Some(Self::SparePartsShopping),
"touristInformation" => Some(Self::TouristInformation),
"truckRepair" => Some(Self::TruckRepair),
"truckWash" => Some(Self::TruckWash),
"tyreRepair" => Some(Self::TyreRepair),
"vehicleMaintenance" => Some(Self::VehicleMaintenance),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ServiceFacilityTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `afac:SquareMetres`.
pub type SquareMetres = com::NonNegativeInteger;
/// XML enumeration `afac:SurchargeTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SurchargeTypeEnum {
/// `reservation`
Reservation,
/// `mobilePayment`
MobilePayment,
/// `deposit`
Deposit,
/// `membershipFee`
MembershipFee,
/// A value outside the standard list.
Extended(String),
}
impl SurchargeTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Reservation => "reservation",
Self::MobilePayment => "mobilePayment",
Self::Deposit => "deposit",
Self::MembershipFee => "membershipFee",
Self::Extended(v) => v,
}
}
}
impl Enumeration for SurchargeTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"reservation" => Some(Self::Reservation),
"mobilePayment" => Some(Self::MobilePayment),
"deposit" => Some(Self::Deposit),
"membershipFee" => Some(Self::MembershipFee),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl SurchargeTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `afac:TimeZone`.
pub type TimeZone = String;
/// XML enumeration `afac:TypeOfIdentifierEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TypeOfIdentifierEnum {
/// A value outside the standard list.
Extended(String),
}
impl TypeOfIdentifierEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Extended(v) => v,
}
}
}
impl Enumeration for TypeOfIdentifierEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TypeOfIdentifierEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:UnitOfTimeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum UnitOfTimeEnum {
/// `second`
Second,
/// `minute`
Minute,
/// `hour`
Hour,
/// `day`
Day,
/// A value outside the standard list.
Extended(String),
}
impl UnitOfTimeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Second => "second",
Self::Minute => "minute",
Self::Hour => "hour",
Self::Day => "day",
Self::Extended(v) => v,
}
}
}
impl Enumeration for UnitOfTimeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"second" => Some(Self::Second),
"minute" => Some(Self::Minute),
"hour" => Some(Self::Hour),
"day" => Some(Self::Day),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl UnitOfTimeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `afac:UserTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum UserTypeEnum {
/// `allUsers`
AllUsers,
/// `commuters`
Commuters,
/// `customers`
Customers,
/// `elderlyUsers`
ElderlyUsers,
/// `employees`
Employees,
/// `families`
Families,
/// `personsWithDisabilities`
PersonsWithDisabilities,
/// `hearingImpaired`
HearingImpaired,
/// `hotelGuests`
HotelGuests,
/// `longTermParkers`
LongTermParkers,
/// `members`
Members,
/// `men`
Men,
/// `overnightParkers`
OvernightParkers,
/// `parkAndCycleUser`
ParkAndCycleUser,
/// `parkAndRideUsers`
ParkAndRideUsers,
/// `parkAndWalkUser`
ParkAndWalkUser,
/// `pensioners`
Pensioners,
/// `pregnantPerson`
PregnantPerson,
/// `registeredDisabledUsers`
RegisteredDisabledUsers,
/// `reservationHolders`
ReservationHolders,
/// `residents`
Residents,
/// `seasonTicketHolders`
SeasonTicketHolders,
/// `shoppers`
Shoppers,
/// `shortTermParkers`
ShortTermParkers,
/// `sportEventAwaySupporters`
SportEventAwaySupporters,
/// `sportEventHomeSupporters`
SportEventHomeSupporters,
/// `students`
Students,
/// `staff`
Staff,
/// `subscribers`
Subscribers,
/// `visitors`
Visitors,
/// `visuallyImpaired`
VisuallyImpaired,
/// `wheelchairUsers`
WheelchairUsers,
/// `women`
Women,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl UserTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AllUsers => "allUsers",
Self::Commuters => "commuters",
Self::Customers => "customers",
Self::ElderlyUsers => "elderlyUsers",
Self::Employees => "employees",
Self::Families => "families",
Self::PersonsWithDisabilities => "personsWithDisabilities",
Self::HearingImpaired => "hearingImpaired",
Self::HotelGuests => "hotelGuests",
Self::LongTermParkers => "longTermParkers",
Self::Members => "members",
Self::Men => "men",
Self::OvernightParkers => "overnightParkers",
Self::ParkAndCycleUser => "parkAndCycleUser",
Self::ParkAndRideUsers => "parkAndRideUsers",
Self::ParkAndWalkUser => "parkAndWalkUser",
Self::Pensioners => "pensioners",
Self::PregnantPerson => "pregnantPerson",
Self::RegisteredDisabledUsers => "registeredDisabledUsers",
Self::ReservationHolders => "reservationHolders",
Self::Residents => "residents",
Self::SeasonTicketHolders => "seasonTicketHolders",
Self::Shoppers => "shoppers",
Self::ShortTermParkers => "shortTermParkers",
Self::SportEventAwaySupporters => "sportEventAwaySupporters",
Self::SportEventHomeSupporters => "sportEventHomeSupporters",
Self::Students => "students",
Self::Staff => "staff",
Self::Subscribers => "subscribers",
Self::Visitors => "visitors",
Self::VisuallyImpaired => "visuallyImpaired",
Self::WheelchairUsers => "wheelchairUsers",
Self::Women => "women",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for UserTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"allUsers" => Some(Self::AllUsers),
"commuters" => Some(Self::Commuters),
"customers" => Some(Self::Customers),
"elderlyUsers" => Some(Self::ElderlyUsers),
"employees" => Some(Self::Employees),
"families" => Some(Self::Families),
"personsWithDisabilities" => Some(Self::PersonsWithDisabilities),
"hearingImpaired" => Some(Self::HearingImpaired),
"hotelGuests" => Some(Self::HotelGuests),
"longTermParkers" => Some(Self::LongTermParkers),
"members" => Some(Self::Members),
"men" => Some(Self::Men),
"overnightParkers" => Some(Self::OvernightParkers),
"parkAndCycleUser" => Some(Self::ParkAndCycleUser),
"parkAndRideUsers" => Some(Self::ParkAndRideUsers),
"parkAndWalkUser" => Some(Self::ParkAndWalkUser),
"pensioners" => Some(Self::Pensioners),
"pregnantPerson" => Some(Self::PregnantPerson),
"registeredDisabledUsers" => Some(Self::RegisteredDisabledUsers),
"reservationHolders" => Some(Self::ReservationHolders),
"residents" => Some(Self::Residents),
"seasonTicketHolders" => Some(Self::SeasonTicketHolders),
"shoppers" => Some(Self::Shoppers),
"shortTermParkers" => Some(Self::ShortTermParkers),
"sportEventAwaySupporters" => Some(Self::SportEventAwaySupporters),
"sportEventHomeSupporters" => Some(Self::SportEventHomeSupporters),
"students" => Some(Self::Students),
"staff" => Some(Self::Staff),
"subscribers" => Some(Self::Subscribers),
"visitors" => Some(Self::Visitors),
"visuallyImpaired" => Some(Self::VisuallyImpaired),
"wheelchairUsers" => Some(Self::WheelchairUsers),
"women" => Some(Self::Women),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl UserTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML type `afac:AfirFacilityLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AfirFacilityLocation {
/// XML element `afac:timeZone`.
pub time_zone: Option<TimeZone>,
/// XML element `afac:address`.
pub address: Option<Box<locx::Address>>,
/// XML element `afac:nutsArea`.
pub nuts_area: Vec<NutsArea>,
}
impl AfirFacilityLocation {
const FIELDS: &'static [u32] = &[0x20c1c, 0x206bc, 0x209d7];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20019);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20c1c => { let v = r.string()?; r.set(&mut e0, v, 3100); }
0x206bc => { let v = Some(locx::Address::read(r)?); r.set(&mut e1, v.map(Box::new), 1724); }
0x209d7 => { let v = Some(NutsArea::read(r)?); e2.extend(v); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
time_zone: e0,
address: e1,
nuts_area: e2,
};
r.close();
Ok(v)
}
}
impl AfirFacilityLocation {
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.time_zone { w.max_len("timeZone", v, 1024)?; w.pattern("timeZone", v, Pattern::TimeZone)?; w.leaf("afac:timeZone", v)?; }
if let Some(v) = &self.address { v.write(w, "afac:address", "", "")?; }
for v in &self.nuts_area { v.write(w, "afac:nutsArea", "", "")?; }
w.end(tag)
}
}
impl AfirFacilityLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2263 => if r.first(&mut seen[0])? { f0 = r.string()?; },
64 => if r.first(&mut seen[1])? { f1 = locx::Address::read_json(r)?.map(Box::new); },
1419 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = NutsArea::read_json(r)? { f2.push(v); } } },
_ => r.skip_unknown()?,
}
}
Ok(Self {
time_zone: f0,
address: f1,
nuts_area: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(54)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.time_zone {
w.key(2263)?;
w.max_len("timeZone", v, 1024)?; w.pattern("timeZone", v, Pattern::TimeZone)?; w.string(v)?;
}
if let Some(v) = &self.address {
w.key(64)?;
v.write_json(w, None)?;
}
if !self.nuts_area.is_empty() {
w.key(1419)?;
w.begin_array()?;
for v in &self.nuts_area {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
w.end_object()
}
}
/// XML type `afac:Amenities`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Amenities {
/// XML element `afac:illuminated`.
pub illuminated: Option<com::Boolean>,
/// XML element `afac:roofed`.
pub roofed: Option<com::Boolean>,
/// XML element `afac:illuminatedRechargingParkingNearby`.
pub illuminated_recharging_parking_nearby: Option<com::Boolean>,
/// XML element `afac:roofedRechargingParkingNearby`.
pub roofed_recharging_parking_nearby: Option<com::Boolean>,
/// XML element `afac:_amenitiesExtension`.
pub amenities_extension: Option<Box<Extension>>,
}
impl Amenities {
const FIELDS: &'static [u32] = &[0x208ae, 0x20b58, 0x208af, 0x20b59, 0x20437];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20030);
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 {
0x208ae => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2222); }
0x20b58 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 2904); }
0x208af => { let v = r.value::<bool>()?; r.set(&mut e2, v, 2223); }
0x20b59 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2905); }
0x20437 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1079); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
illuminated: e0,
roofed: e1,
illuminated_recharging_parking_nearby: e2,
roofed_recharging_parking_nearby: e3,
amenities_extension: e4,
};
r.close();
Ok(v)
}
}
impl Amenities {
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.illuminated { w.leaf("afac:illuminated", v)?; }
if let Some(v) = &self.roofed { w.leaf("afac:roofed", v)?; }
if let Some(v) = &self.illuminated_recharging_parking_nearby { w.leaf("afac:illuminatedRechargingParkingNearby", v)?; }
if let Some(v) = &self.roofed_recharging_parking_nearby { w.leaf("afac:roofedRechargingParkingNearby", v)?; }
if let Some(v) = &self.amenities_extension { w.extension("afac:_amenitiesExtension", v)?; }
w.end(tag)
}
}
impl Amenities {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
967 => if r.first(&mut seen[0])? { f0 = r.boolean()?; },
1991 => if r.first(&mut seen[1])? { f1 = r.boolean()?; },
968 => if r.first(&mut seen[2])? { f2 = r.boolean()?; },
1992 => if r.first(&mut seen[3])? { f3 = r.boolean()?; },
110 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
illuminated: f0,
roofed: f1,
illuminated_recharging_parking_nearby: f2,
roofed_recharging_parking_nearby: f3,
amenities_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(55)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.illuminated {
w.key(967)?;
w.boolean(*v)?;
}
if let Some(v) = &self.roofed {
w.key(1991)?;
w.boolean(*v)?;
}
if let Some(v) = &self.illuminated_recharging_parking_nearby {
w.key(968)?;
w.boolean(*v)?;
}
if let Some(v) = &self.roofed_recharging_parking_nearby {
w.key(1992)?;
w.boolean(*v)?;
}
if let Some(v) = &self.amenities_extension {
w.key(110)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:AmountInCurrency`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AmountInCurrency {
/// XML element `afac:currencyValue`.
pub currency_value: Option<AmountOfMoney>,
/// XML element `afac:currencyType`.
pub currency_type: Option<CurrencyCode>,
/// XML element `afac:_amountInCurrencyExtension`.
pub amount_in_currency_extension: Option<Box<Extension>>,
}
impl AmountInCurrency {
const FIELDS: &'static [u32] = &[0x20780, 0x2077f, 0x20438];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20031);
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 {
0x20780 => { let v = r.value::<Decimal>()?; r.set(&mut e0, v, 1920); }
0x2077f => { let v = r.string()?; r.set(&mut e1, v, 1919); }
0x20438 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1080); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1920);
r.required(&e1, 1919);
let v = Self {
currency_value: e0,
currency_type: e1,
amount_in_currency_extension: e2,
};
r.close();
Ok(v)
}
}
impl AmountInCurrency {
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.currency_value {
Some(v) => { w.digits("currencyValue", v, 8, 2)?; w.leaf("afac:currencyValue", v)?; }
None => return Err(w.missing("afac:currencyValue")),
}
match &self.currency_type {
Some(v) => { w.max_len("currencyType", v, 1024)?; w.pattern("currencyType", v, Pattern::CurrencyCode)?; w.leaf("afac:currencyType", v)?; }
None => return Err(w.missing("afac:currencyType")),
}
if let Some(v) = &self.amount_in_currency_extension { w.extension("afac:_amountInCurrencyExtension", v)?; }
w.end(tag)
}
}
impl AmountInCurrency {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
478 => if r.first(&mut seen[0])? { f0 = r.number::<Decimal>()?; },
477 => if r.first(&mut seen[1])? { f1 = r.string()?; },
111 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 478);
r.required(&f1, 477);
Ok(Self {
currency_value: f0,
currency_type: f1,
amount_in_currency_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(56)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.currency_value {
Some(v) => {
w.key(478)?;
w.digits("currencyValue", v, 8, 2)?; w.decimal(v)?;
}
None => w.absent(478, w.missing("currencyValue"))?,
}
match &self.currency_type {
Some(v) => {
w.key(477)?;
w.max_len("currencyType", v, 1024)?; w.pattern("currencyType", v, Pattern::CurrencyCode)?; w.string(v)?;
}
None => w.absent(477, w.missing("currencyType"))?,
}
if let Some(v) = &self.amount_in_currency_extension {
w.key(111)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:AnOrganisation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AnOrganisation {
/// XML element `afac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:legalName`.
pub legal_name: Option<MultilingualString>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:linkToGeneralInformation`.
pub link_to_general_information: Option<com::Url>,
/// XML element `afac:linkToLogo`.
pub link_to_logo: Option<com::Url>,
/// XML element `afac:linkToWebform`.
pub link_to_webform: Option<com::Url>,
/// XML element `afac:available24hours`.
pub available24hours: Option<com::Boolean>,
/// XML element `afac:responsibility`.
pub responsibility: Vec<MultilingualString>,
/// XML element `afac:publishingAgreement`.
pub publishing_agreement: Option<com::Boolean>,
/// XML element `afac:type`.
pub r#type: Option<OrganisationTypeEnum>,
/// XML element `afac:nationalOrganisationNumber`.
pub national_organisation_number: Option<String>,
/// XML element `afac:nationalRegister`.
pub national_register: Option<String>,
/// XML element `afac:vatIdentificationNumber`.
pub vat_identification_number: Option<String>,
/// XML element `afac:organisationUnit`.
pub organisation_unit: Vec<OrganisationUnit>,
/// XML element `afac:externalIdentifier`.
pub external_identifier: Vec<ExternalIdentifier>,
/// XML element `afac:subOrganisation`.
pub sub_organisation: Vec<Organisation>,
/// XML element `afac:_anOrganisationExtension`.
pub an_organisation_extension: Option<Box<Extension>>,
}
impl AnOrganisation {
const FIELDS: &'static [u32] = &[0x2087b, 0x2055a, 0x208f8, 0x2098b, 0x20901, 0x207a8, 0x20914, 0x20915, 0x20916, 0x20706, 0x20b37, 0x20adc, 0x20c5d, 0x20992, 0x20993, 0x20c8e, 0x20a25, 0x20840, 0x20be4, 0x20439];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20032);
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = Vec::new();
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
let mut e15 = None;
let mut e16 = Vec::new();
let mut e17 = Vec::new();
let mut e18 = Vec::new();
let mut e19 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0x2055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0x2098b => { let v = r.multilingual()?; r.set(&mut e3, v, 2443); }
0x20901 => { let v = r.multilingual()?; r.set(&mut e4, v, 2305); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e5, v, 1960); }
0x20914 => { let v = r.string()?; r.set(&mut e6, v, 2324); }
0x20915 => { let v = r.string()?; r.set(&mut e7, v, 2325); }
0x20916 => { let v = r.string()?; r.set(&mut e8, v, 2326); }
0x20706 => { let v = r.value::<bool>()?; r.set(&mut e9, v, 1798); }
0x20b37 => { let v = r.multilingual()?; e10.extend(v); }
0x20adc => { let v = r.value::<bool>()?; r.set(&mut e11, v, 2780); }
0x20c5d => { let v = r.enumeration::<OrganisationTypeEnum>()?; r.set(&mut e12, v, 3165); }
0x20992 => { let v = r.string()?; r.set(&mut e13, v, 2450); }
0x20993 => { let v = r.string()?; r.set(&mut e14, v, 2451); }
0x20c8e => { let v = r.string()?; r.set(&mut e15, v, 3214); }
0x20a25 => { let v = Some(OrganisationUnit::read(r)?); e16.extend(v); }
0x20840 => { let v = Some(ExternalIdentifier::read(r)?); e17.extend(v); }
0x20be4 => { let v = Organisation::read(r)?; e18.extend(v); }
0x20439 => { let v = r.raw()?; r.set(&mut e19, v.map(Box::new), 1081); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2443);
let v = Self {
general_time_validity: e0,
organisation_extension: e1,
last_updated: e2,
name: e3,
legal_name: e4,
description: e5,
link_to_general_information: e6,
link_to_logo: e7,
link_to_webform: e8,
available24hours: e9,
responsibility: e10,
publishing_agreement: e11,
r#type: e12,
national_organisation_number: e13,
national_register: e14,
vat_identification_number: e15,
organisation_unit: e16,
external_identifier: e17,
sub_organisation: e18,
an_organisation_extension: e19,
};
r.close();
Ok(v)
}
}
impl AnOrganisation {
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.general_time_validity { v.write(w, "afac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("afac:_organisationExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
match &self.name {
Some(v) => { w.multilingual("afac:name", v)?; }
None => return Err(w.missing("afac:name")),
}
if let Some(v) = &self.legal_name { w.multilingual("afac:legalName", v)?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
if let Some(v) = &self.link_to_general_information { w.leaf("afac:linkToGeneralInformation", v)?; }
if let Some(v) = &self.link_to_logo { w.leaf("afac:linkToLogo", v)?; }
if let Some(v) = &self.link_to_webform { w.leaf("afac:linkToWebform", v)?; }
if let Some(v) = &self.available24hours { w.leaf("afac:available24hours", v)?; }
for v in &self.responsibility { w.multilingual("afac:responsibility", v)?; }
if let Some(v) = &self.publishing_agreement { w.leaf("afac:publishingAgreement", v)?; }
if let Some(v) = &self.r#type { w.enumeration("afac:type", v.literal())?; }
if let Some(v) = &self.national_organisation_number { w.max_len("nationalOrganisationNumber", v, 1024)?; w.leaf("afac:nationalOrganisationNumber", v)?; }
if let Some(v) = &self.national_register { w.max_len("nationalRegister", v, 1024)?; w.leaf("afac:nationalRegister", v)?; }
if let Some(v) = &self.vat_identification_number { w.max_len("vatIdentificationNumber", v, 1024)?; w.leaf("afac:vatIdentificationNumber", v)?; }
for v in &self.organisation_unit { v.write(w, "afac:organisationUnit", "", "")?; }
for v in &self.external_identifier { v.write(w, "afac:externalIdentifier", "", "")?; }
for v in &self.sub_organisation { v.write(w, "afac:subOrganisation")?; }
if let Some(v) = &self.an_organisation_extension { w.extension("afac:_anOrganisationExtension", v)?; }
w.end(tag)
}
}
impl AnOrganisation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 20];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = Vec::new();
let mut f11 = None;
let mut f12 = None;
let mut f13 = None;
let mut f14 = None;
let mut f15 = None;
let mut f16 = Vec::new();
let mut f17 = Vec::new();
let mut f18 = Vec::new();
let mut f19 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
916 => if r.first(&mut seen[0])? { f0 = com::OverallPeriod::read_json(r)?.map(Box::new); },
153 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1043 => if r.first(&mut seen[2])? { f2 = r.date_time()?; },
1345 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1052 => if r.first(&mut seen[4])? { f4 = r.multilingual()?; },
545 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
1071 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1072 => if r.first(&mut seen[7])? { f7 = r.string()?; },
1073 => if r.first(&mut seen[8])? { f8 = r.string()?; },
273 => if r.first(&mut seen[9])? { f9 = r.boolean()?; },
1894 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f10.push(v); } } },
1780 => if r.first(&mut seen[11])? { f11 = r.boolean()?; },
2495 => if r.first(&mut seen[12])? { f12 = r.enumeration::<OrganisationTypeEnum>()?; },
1351 => if r.first(&mut seen[13])? { f13 = r.string()?; },
1352 => if r.first(&mut seen[14])? { f14 = r.string()?; },
2547 => if r.first(&mut seen[15])? { f15 = r.string()?; },
1496 => if r.first(&mut seen[16])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OrganisationUnit::read_json(r)? { f16.push(v); } } },
739 => if r.first(&mut seen[17])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalIdentifier::read_json(r)? { f17.push(v); } } },
2208 => if r.first(&mut seen[18])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Organisation::read_json(r)? { f18.push(v); } } },
113 => if r.first(&mut seen[19])? { f19 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f3, 1345);
Ok(Self {
general_time_validity: f0,
organisation_extension: f1,
last_updated: f2,
name: f3,
legal_name: f4,
description: f5,
link_to_general_information: f6,
link_to_logo: f7,
link_to_webform: f8,
available24hours: f9,
responsibility: f10,
publishing_agreement: f11,
r#type: f12,
national_organisation_number: f13,
national_register: f14,
vat_identification_number: f15,
organisation_unit: f16,
external_identifier: f17,
sub_organisation: f18,
an_organisation_extension: f19,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(57)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.general_time_validity {
w.key(916)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.organisation_extension {
w.key(153)?;
w.extension(v)?;
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
match &self.name {
Some(v) => {
w.key(1345)?;
w.multilingual(v)?;
}
None => w.absent(1345, w.missing("name"))?,
}
if let Some(v) = &self.legal_name {
w.key(1052)?;
w.multilingual(v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if let Some(v) = &self.link_to_general_information {
w.key(1071)?;
w.string(v)?;
}
if let Some(v) = &self.link_to_logo {
w.key(1072)?;
w.string(v)?;
}
if let Some(v) = &self.link_to_webform {
w.key(1073)?;
w.string(v)?;
}
if let Some(v) = &self.available24hours {
w.key(273)?;
w.boolean(*v)?;
}
if !self.responsibility.is_empty() {
w.key(1894)?;
w.begin_array()?;
for v in &self.responsibility {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.publishing_agreement {
w.key(1780)?;
w.boolean(*v)?;
}
if let Some(v) = &self.r#type {
w.key(2495)?;
w.enumeration(99, v.literal())?;
}
if let Some(v) = &self.national_organisation_number {
w.key(1351)?;
w.max_len("nationalOrganisationNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.national_register {
w.key(1352)?;
w.max_len("nationalRegister", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vat_identification_number {
w.key(2547)?;
w.max_len("vatIdentificationNumber", v, 1024)?; w.string(v)?;
}
if !self.organisation_unit.is_empty() {
w.key(1496)?;
w.begin_array()?;
for v in &self.organisation_unit {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.external_identifier.is_empty() {
w.key(739)?;
w.begin_array()?;
for v in &self.external_identifier {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.sub_organisation.is_empty() {
w.key(2208)?;
w.begin_array()?;
for v in &self.sub_organisation {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.an_organisation_extension {
w.key(113)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:AssociatedFacility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AssociatedFacility {
/// XML element `afac:type`.
pub r#type: Option<FacilityTypeEnum>,
/// XML element `afac:facilityReference`.
pub facility_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:_associatedFacilityExtension`.
pub associated_facility_extension: Option<Box<Extension>>,
}
impl AssociatedFacility {
const FIELDS: &'static [u32] = &[0x20c5d, 0x20848, 0x207a8, 0x20440];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20039);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20c5d => { let v = r.enumeration::<FacilityTypeEnum>()?; r.set(&mut e0, v, 3165); }
0x20848 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e1, v.map(Box::new), 2120); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e2, v, 1960); }
0x20440 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1088); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3165);
let v = Self {
r#type: e0,
facility_reference: e1,
description: e2,
associated_facility_extension: e3,
};
r.close();
Ok(v)
}
}
impl AssociatedFacility {
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.r#type {
Some(v) => { w.enumeration("afac:type", v.literal())?; }
None => return Err(w.missing("afac:type")),
}
if let Some(v) = &self.facility_reference { v.write(w, "afac:facilityReference", "", " targetClass=\"afac:FacilityObject\"")?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
if let Some(v) = &self.associated_facility_extension { w.extension("afac:_associatedFacilityExtension", v)?; }
w.end(tag)
}
}
impl AssociatedFacility {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2495 => if r.first(&mut seen[0])? { f0 = r.enumeration::<FacilityTypeEnum>()?; },
830 => if r.first(&mut seen[1])? { f1 = com::VersionedReference::read_json(r)?.map(Box::new); },
545 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
116 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2495);
Ok(Self {
r#type: f0,
facility_reference: f1,
description: f2,
associated_facility_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(60)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.r#type {
Some(v) => {
w.key(2495)?;
w.enumeration(79, v.literal())?;
}
None => w.absent(2495, w.missing("type"))?,
}
if let Some(v) = &self.facility_reference {
w.key(830)?;
v.write_json(w, Some("FacilityObject"))?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if let Some(v) = &self.associated_facility_extension {
w.key(116)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:ClosureInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ClosureInformation {
/// XML element `afac:permananentlyClosed`.
pub permananently_closed: Option<com::Boolean>,
/// XML element `afac:temporarilyClosed`.
pub temporarily_closed: Option<com::Boolean>,
/// XML element `afac:closedFrom`.
pub closed_from: Option<DateTime>,
/// XML element `afac:temporarilyClosedUntil`.
pub temporarily_closed_until: Option<DateTime>,
/// XML element `afac:_closureInformationExtension`.
pub closure_information_extension: Option<Box<Extension>>,
}
impl ClosureInformation {
const FIELDS: &'static [u32] = &[0x20a66, 0x20c06, 0x20749, 0x20c07, 0x20457];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20051);
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 {
0x20a66 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2662); }
0x20c06 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 3078); }
0x20749 => { let v = r.date_time()?; r.set(&mut e2, v, 1865); }
0x20c07 => { let v = r.date_time()?; r.set(&mut e3, v, 3079); }
0x20457 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1111); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
permananently_closed: e0,
temporarily_closed: e1,
closed_from: e2,
temporarily_closed_until: e3,
closure_information_extension: e4,
};
r.close();
Ok(v)
}
}
impl ClosureInformation {
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.permananently_closed { w.leaf("afac:permananentlyClosed", v)?; }
if let Some(v) = &self.temporarily_closed { w.leaf("afac:temporarilyClosed", v)?; }
if let Some(v) = &self.closed_from { w.leaf("afac:closedFrom", v)?; }
if let Some(v) = &self.temporarily_closed_until { w.leaf("afac:temporarilyClosedUntil", v)?; }
if let Some(v) = &self.closure_information_extension { w.extension("afac:_closureInformationExtension", v)?; }
w.end(tag)
}
}
impl ClosureInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1560 => if r.first(&mut seen[0])? { f0 = r.boolean()?; },
2241 => if r.first(&mut seen[1])? { f1 = r.boolean()?; },
343 => if r.first(&mut seen[2])? { f2 = r.date_time()?; },
2242 => if r.first(&mut seen[3])? { f3 = r.date_time()?; },
117 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
permananently_closed: f0,
temporarily_closed: f1,
closed_from: f2,
temporarily_closed_until: f3,
closure_information_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(63)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.permananently_closed {
w.key(1560)?;
w.boolean(*v)?;
}
if let Some(v) = &self.temporarily_closed {
w.key(2241)?;
w.boolean(*v)?;
}
if let Some(v) = &self.closed_from {
w.key(343)?;
w.date_time(v)?;
}
if let Some(v) = &self.temporarily_closed_until {
w.key(2242)?;
w.date_time(v)?;
}
if let Some(v) = &self.closure_information_extension {
w.key(117)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:ContactInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ContactInformation {
/// XML element `afac:language`.
pub language: Vec<com::Language>,
/// XML element `afac:telephoneNumber`.
pub telephone_number: Option<String>,
/// XML element `afac:faxNumber`.
pub fax_number: Option<String>,
/// XML element `afac:eMail`.
pub e_mail: Option<String>,
/// XML element `afac:_contactInformationExtension`.
pub contact_information_extension: Option<Box<Extension>>,
}
impl ContactInformation {
const FIELDS: &'static [u32] = &[0x208ee, 0x20c03, 0x20858, 0x207e4, 0x20464];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2005e);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x208ee => { let v = r.string()?; e0.extend(v); }
0x20c03 => { let v = r.string()?; r.set(&mut e1, v, 3075); }
0x20858 => { let v = r.string()?; r.set(&mut e2, v, 2136); }
0x207e4 => { let v = r.string()?; r.set(&mut e3, v, 2020); }
0x20464 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1124); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
language: e0,
telephone_number: e1,
fax_number: e2,
e_mail: e3,
contact_information_extension: e4,
};
r.close();
Ok(v)
}
}
impl ContactInformation {
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)?;
for v in &self.language { w.pattern("language", v, Pattern::Language)?; w.leaf("afac:language", v)?; }
if let Some(v) = &self.telephone_number { w.max_len("telephoneNumber", v, 1024)?; w.leaf("afac:telephoneNumber", v)?; }
if let Some(v) = &self.fax_number { w.max_len("faxNumber", v, 1024)?; w.leaf("afac:faxNumber", v)?; }
if let Some(v) = &self.e_mail { w.max_len("eMail", v, 1024)?; w.leaf("afac:eMail", v)?; }
if let Some(v) = &self.contact_information_extension { w.extension("afac:_contactInformationExtension", v)?; }
w.end(tag)
}
}
impl ContactInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1033 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
2238 => if r.first(&mut seen[1])? { f1 = r.string()?; },
846 => if r.first(&mut seen[2])? { f2 = r.string()?; },
605 => if r.first(&mut seen[3])? { f3 = r.string()?; },
119 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
language: f0,
telephone_number: f1,
fax_number: f2,
e_mail: f3,
contact_information_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(64)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.language.is_empty() {
w.key(1033)?;
w.begin_array()?;
for v in &self.language {
w.item()?;
w.pattern("language", v, Pattern::Language)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.telephone_number {
w.key(2238)?;
w.max_len("telephoneNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.fax_number {
w.key(846)?;
w.max_len("faxNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.e_mail {
w.key(605)?;
w.max_len("eMail", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.contact_information_extension {
w.key(119)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:ContactPerson`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ContactPerson {
/// XML element `afac:language`.
pub language: Vec<com::Language>,
/// XML element `afac:telephoneNumber`.
pub telephone_number: Option<String>,
/// XML element `afac:faxNumber`.
pub fax_number: Option<String>,
/// XML element `afac:eMail`.
pub e_mail: Option<String>,
/// XML element `afac:_contactInformationExtension`.
pub contact_information_extension: Option<Box<Extension>>,
/// XML element `afac:name`.
pub name: Option<String>,
/// XML element `afac:firstName`.
pub first_name: Option<String>,
/// XML element `afac:title`.
pub title: Option<MultilingualString>,
/// XML element `afac:position`.
pub position: Option<MultilingualString>,
/// XML element `afac:_contactPersonExtension`.
pub contact_person_extension: Option<Box<Extension>>,
}
impl ContactPerson {
const FIELDS: &'static [u32] = &[0x208ee, 0x20c03, 0x20858, 0x207e4, 0x20464, 0x2098b, 0x2085e, 0x20c1e, 0x20a94, 0x20465];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2005f);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
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 = None;
let mut e9 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x208ee => { let v = r.string()?; e0.extend(v); }
0x20c03 => { let v = r.string()?; r.set(&mut e1, v, 3075); }
0x20858 => { let v = r.string()?; r.set(&mut e2, v, 2136); }
0x207e4 => { let v = r.string()?; r.set(&mut e3, v, 2020); }
0x20464 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1124); }
0x2098b => { let v = r.string()?; r.set(&mut e5, v, 2443); }
0x2085e => { let v = r.string()?; r.set(&mut e6, v, 2142); }
0x20c1e => { let v = r.multilingual()?; r.set(&mut e7, v, 3102); }
0x20a94 => { let v = r.multilingual()?; r.set(&mut e8, v, 2708); }
0x20465 => { let v = r.raw()?; r.set(&mut e9, v.map(Box::new), 1125); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e5, 2443);
let v = Self {
language: e0,
telephone_number: e1,
fax_number: e2,
e_mail: e3,
contact_information_extension: e4,
name: e5,
first_name: e6,
title: e7,
position: e8,
contact_person_extension: e9,
};
r.close();
Ok(v)
}
}
impl ContactPerson {
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)?;
for v in &self.language { w.pattern("language", v, Pattern::Language)?; w.leaf("afac:language", v)?; }
if let Some(v) = &self.telephone_number { w.max_len("telephoneNumber", v, 1024)?; w.leaf("afac:telephoneNumber", v)?; }
if let Some(v) = &self.fax_number { w.max_len("faxNumber", v, 1024)?; w.leaf("afac:faxNumber", v)?; }
if let Some(v) = &self.e_mail { w.max_len("eMail", v, 1024)?; w.leaf("afac:eMail", v)?; }
if let Some(v) = &self.contact_information_extension { w.extension("afac:_contactInformationExtension", v)?; }
match &self.name {
Some(v) => { w.max_len("name", v, 1024)?; w.leaf("afac:name", v)?; }
None => return Err(w.missing("afac:name")),
}
if let Some(v) = &self.first_name { w.max_len("firstName", v, 1024)?; w.leaf("afac:firstName", v)?; }
if let Some(v) = &self.title { w.multilingual("afac:title", v)?; }
if let Some(v) = &self.position { w.multilingual("afac:position", v)?; }
if let Some(v) = &self.contact_person_extension { w.extension("afac:_contactPersonExtension", v)?; }
w.end(tag)
}
}
impl ContactPerson {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 10];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1033 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
2238 => if r.first(&mut seen[1])? { f1 = r.string()?; },
846 => if r.first(&mut seen[2])? { f2 = r.string()?; },
605 => if r.first(&mut seen[3])? { f3 = r.string()?; },
119 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
1345 => if r.first(&mut seen[5])? { f5 = r.string()?; },
852 => if r.first(&mut seen[6])? { f6 = r.string()?; },
2265 => if r.first(&mut seen[7])? { f7 = r.multilingual()?; },
1606 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
121 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f5, 1345);
Ok(Self {
language: f0,
telephone_number: f1,
fax_number: f2,
e_mail: f3,
contact_information_extension: f4,
name: f5,
first_name: f6,
title: f7,
position: f8,
contact_person_extension: f9,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(66)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.language.is_empty() {
w.key(1033)?;
w.begin_array()?;
for v in &self.language {
w.item()?;
w.pattern("language", v, Pattern::Language)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.telephone_number {
w.key(2238)?;
w.max_len("telephoneNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.fax_number {
w.key(846)?;
w.max_len("faxNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.e_mail {
w.key(605)?;
w.max_len("eMail", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.contact_information_extension {
w.key(119)?;
w.extension(v)?;
}
match &self.name {
Some(v) => {
w.key(1345)?;
w.max_len("name", v, 1024)?; w.string(v)?;
}
None => w.absent(1345, w.missing("name"))?,
}
if let Some(v) = &self.first_name {
w.key(852)?;
w.max_len("firstName", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.title {
w.key(2265)?;
w.multilingual(v)?;
}
if let Some(v) = &self.position {
w.key(1606)?;
w.multilingual(v)?;
}
if let Some(v) = &self.contact_person_extension {
w.key(121)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Credential`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Credential {
/// XML element `afac:type`.
pub r#type: Option<CredentialTypeEnum>,
/// XML element `afac:otherType`.
pub other_type: Option<String>,
/// XML element `afac:_credentialExtension`.
pub credential_extension: Option<Box<Extension>>,
}
impl Credential {
const FIELDS: &'static [u32] = &[0x20c5d, 0x20a32, 0x2046d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20066);
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 {
0x20c5d => { let v = r.enumeration::<CredentialTypeEnum>()?; r.set(&mut e0, v, 3165); }
0x20a32 => { let v = r.string()?; r.set(&mut e1, v, 2610); }
0x2046d => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1133); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3165);
let v = Self {
r#type: e0,
other_type: e1,
credential_extension: e2,
};
r.close();
Ok(v)
}
}
impl Credential {
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.r#type {
Some(v) => { w.enumeration("afac:type", v.literal())?; }
None => return Err(w.missing("afac:type")),
}
if let Some(v) = &self.other_type { w.max_len("otherType", v, 1024)?; w.leaf("afac:otherType", v)?; }
if let Some(v) = &self.credential_extension { w.extension("afac:_credentialExtension", v)?; }
w.end(tag)
}
}
impl Credential {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2495 => if r.first(&mut seen[0])? { f0 = r.enumeration::<CredentialTypeEnum>()?; },
1509 => if r.first(&mut seen[1])? { f1 = r.string()?; },
125 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2495);
Ok(Self {
r#type: f0,
other_type: f1,
credential_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(67)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.r#type {
Some(v) => {
w.key(2495)?;
w.enumeration(70, v.literal())?;
}
None => w.absent(2495, w.missing("type"))?,
}
if let Some(v) = &self.other_type {
w.key(1509)?;
w.max_len("otherType", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.credential_extension {
w.key(125)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:CredentialAssigned`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct CredentialAssigned {
/// XML element `afac:type`.
pub r#type: Option<CredentialTypeEnum>,
/// XML element `afac:otherType`.
pub other_type: Option<String>,
/// XML element `afac:_credentialExtension`.
pub credential_extension: Option<Box<Extension>>,
/// XML element `afac:localIdentifier`.
pub local_identifier: Option<String>,
/// XML element `afac:issuer`.
pub issuer: Option<Box<com::VersionedReference>>,
/// XML element `afac:_credentialAssignedExtension`.
pub credential_assigned_extension: Option<Box<Extension>>,
}
impl CredentialAssigned {
const FIELDS: &'static [u32] = &[0x20c5d, 0x20a32, 0x2046d, 0x20919, 0x208dc, 0x2046c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20067);
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 {
0x20c5d => { let v = r.enumeration::<CredentialTypeEnum>()?; r.set(&mut e0, v, 3165); }
0x20a32 => { let v = r.string()?; r.set(&mut e1, v, 2610); }
0x2046d => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1133); }
0x20919 => { let v = r.string()?; r.set(&mut e3, v, 2329); }
0x208dc => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 2268); }
0x2046c => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1132); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3165);
r.required(&e4, 2268);
let v = Self {
r#type: e0,
other_type: e1,
credential_extension: e2,
local_identifier: e3,
issuer: e4,
credential_assigned_extension: e5,
};
r.close();
Ok(v)
}
}
impl CredentialAssigned {
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.r#type {
Some(v) => { w.enumeration("afac:type", v.literal())?; }
None => return Err(w.missing("afac:type")),
}
if let Some(v) = &self.other_type { w.max_len("otherType", v, 1024)?; w.leaf("afac:otherType", v)?; }
if let Some(v) = &self.credential_extension { w.extension("afac:_credentialExtension", v)?; }
if let Some(v) = &self.local_identifier { w.max_len("localIdentifier", v, 1024)?; w.leaf("afac:localIdentifier", v)?; }
match &self.issuer {
Some(v) => { v.write(w, "afac:issuer", "", " targetClass=\"afac:Organisation\"")?; }
None => return Err(w.missing("afac:issuer")),
}
if let Some(v) = &self.credential_assigned_extension { w.extension("afac:_credentialAssignedExtension", v)?; }
w.end(tag)
}
}
impl CredentialAssigned {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2495 => if r.first(&mut seen[0])? { f0 = r.enumeration::<CredentialTypeEnum>()?; },
1509 => if r.first(&mut seen[1])? { f1 = r.string()?; },
125 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1227 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1015 => if r.first(&mut seen[4])? { f4 = com::VersionedReference::read_json(r)?.map(Box::new); },
124 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2495);
r.required(&f4, 1015);
Ok(Self {
r#type: f0,
other_type: f1,
credential_extension: f2,
local_identifier: f3,
issuer: f4,
credential_assigned_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(68)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.r#type {
Some(v) => {
w.key(2495)?;
w.enumeration(70, v.literal())?;
}
None => w.absent(2495, w.missing("type"))?,
}
if let Some(v) = &self.other_type {
w.key(1509)?;
w.max_len("otherType", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.credential_extension {
w.key(125)?;
w.extension(v)?;
}
if let Some(v) = &self.local_identifier {
w.key(1227)?;
w.max_len("localIdentifier", v, 1024)?; w.string(v)?;
}
match &self.issuer {
Some(v) => {
w.key(1015)?;
v.write_json(w, Some("Organisation"))?;
}
None => w.absent(1015, w.missing("issuer"))?,
}
if let Some(v) = &self.credential_assigned_extension {
w.key(124)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Dimension`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Dimension {
/// XML element `afac:length`.
pub length: Option<com::MetresAsFloat>,
/// XML element `afac:width`.
pub width: Option<com::MetresAsFloat>,
/// XML element `afac:height`.
pub height: Option<com::MetresAsFloat>,
/// XML element `afac:usableArea`.
pub usable_area: Option<SquareMetres>,
/// XML element `afac:_dimensionExtension`.
pub dimension_extension: Option<Box<Extension>>,
}
impl Dimension {
const FIELDS: &'static [u32] = &[0x20903, 0x20cd7, 0x20897, 0x20c75, 0x20484];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2007f);
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 {
0x20903 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2307); }
0x20cd7 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3287); }
0x20897 => { let v = r.value::<f32>()?; r.set(&mut e2, v, 2199); }
0x20c75 => { let v = r.value::<u64>()?; r.set(&mut e3, v, 3189); }
0x20484 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1156); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
length: e0,
width: e1,
height: e2,
usable_area: e3,
dimension_extension: e4,
};
r.close();
Ok(v)
}
}
impl Dimension {
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.length { w.leaf("afac:length", v)?; }
if let Some(v) = &self.width { w.leaf("afac:width", v)?; }
if let Some(v) = &self.height { w.leaf("afac:height", v)?; }
if let Some(v) = &self.usable_area { w.leaf("afac:usableArea", v)?; }
if let Some(v) = &self.dimension_extension { w.extension("afac:_dimensionExtension", v)?; }
w.end(tag)
}
}
impl Dimension {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1054 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
2668 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
944 => if r.first(&mut seen[2])? { f2 = r.number::<f32>()?; },
2522 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
126 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
length: f0,
width: f1,
height: f2,
usable_area: f3,
dimension_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(71)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.length {
w.key(1054)?;
w.float32(*v)?;
}
if let Some(v) = &self.width {
w.key(2668)?;
w.float32(*v)?;
}
if let Some(v) = &self.height {
w.key(944)?;
w.float32(*v)?;
}
if let Some(v) = &self.usable_area {
w.key(2522)?;
w.integer(*v)?;
}
if let Some(v) = &self.dimension_extension {
w.key(126)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:DurationValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DurationValue {
/// XML attribute `accuracy`.
pub accuracy: Option<com::Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<com::ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<com::NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<com::NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<com::Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<com::Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<com::Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<com::Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `afac:duration`.
pub duration: Option<com::Seconds>,
/// XML element `afac:_durationValueExtension`.
pub duration_value_extension: Option<Box<Extension>>,
}
impl DurationValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x207db, 0x20491];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2008c);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<com::ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
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 {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x207db => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2011); }
0x20491 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1169); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2011);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
duration: e3,
duration_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl DurationValue {
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.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.duration {
Some(v) => { w.leaf("afac:duration", v)?; }
None => return Err(w.missing("afac:duration")),
}
if let Some(v) = &self.duration_value_extension { w.extension("afac:_durationValueExtension", v)?; }
w.end(tag)
}
}
impl DurationValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<com::ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
596 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
127 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
432 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 596);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
duration: f10,
duration_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(72)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.duration {
Some(v) => {
w.key(596)?;
w.float32(*v)?;
}
None => w.absent(596, w.missing("duration"))?,
}
if let Some(v) = &self.duration_value_extension {
w.key(127)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Eligibility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Eligibility {
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:noFeeToUse`.
pub no_fee_to_use: Option<com::Boolean>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:priority`.
pub priority: Option<com::NonNegativeInteger>,
/// XML element `afac:combinable`.
pub combinable: Option<com::Boolean>,
/// XML element `afac:qualification`.
pub qualification: Vec<Qualification>,
/// XML element `afac:rateDiscount`.
pub rate_discount: Option<Box<RateDiscount>>,
/// XML element `afac:rightSpecification`.
pub right_specification: Vec<RightSpecification>,
/// XML element `afac:_eligibilityExtension`.
pub eligibility_extension: Option<Box<Extension>>,
}
impl Eligibility {
const FIELDS: &'static [u32] = &[0x2098b, 0x2099e, 0x207a8, 0x20abf, 0x20751, 0x20add, 0x20ae5, 0x20b3f, 0x2049f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2009a);
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 {
0x2098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0x2099e => { let v = r.value::<bool>()?; r.set(&mut e1, v, 2462); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e2, v, 1960); }
0x20abf => { let v = r.value::<u64>()?; r.set(&mut e3, v, 2751); }
0x20751 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 1873); }
0x20add => { let v = Some(Qualification::read(r)?); e5.extend(v); }
0x20ae5 => { let v = Some(RateDiscount::read(r)?); r.set(&mut e6, v.map(Box::new), 2789); }
0x20b3f => { let v = Some(RightSpecification::read(r)?); e7.extend(v); }
0x2049f => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1183); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
name: e0,
no_fee_to_use: e1,
description: e2,
priority: e3,
combinable: e4,
qualification: e5,
rate_discount: e6,
right_specification: e7,
eligibility_extension: e8,
};
r.close();
Ok(v)
}
}
impl Eligibility {
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.name { w.multilingual("afac:name", v)?; }
if let Some(v) = &self.no_fee_to_use { w.leaf("afac:noFeeToUse", v)?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
if let Some(v) = &self.priority { w.leaf("afac:priority", v)?; }
if let Some(v) = &self.combinable { w.leaf("afac:combinable", v)?; }
for v in &self.qualification { v.write(w, "afac:qualification", "", "")?; }
if let Some(v) = &self.rate_discount { v.write(w, "afac:rateDiscount", "", "")?; }
for v in &self.right_specification { v.write(w, "afac:rightSpecification", "", "")?; }
if let Some(v) = &self.eligibility_extension { w.extension("afac:_eligibilityExtension", v)?; }
w.end(tag)
}
}
impl Eligibility {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 9];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = Vec::new();
let mut f6 = None;
let mut f7 = Vec::new();
let mut f8 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1345 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1362 => if r.first(&mut seen[1])? { f1 = r.boolean()?; },
545 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
1649 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
415 => if r.first(&mut seen[4])? { f4 = r.boolean()?; },
1781 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Qualification::read_json(r)? { f5.push(v); } } },
1789 => if r.first(&mut seen[6])? { f6 = RateDiscount::read_json(r)?.map(Box::new); },
1902 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RightSpecification::read_json(r)? { f7.push(v); } } },
128 => if r.first(&mut seen[8])? { f8 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
name: f0,
no_fee_to_use: f1,
description: f2,
priority: f3,
combinable: f4,
qualification: f5,
rate_discount: f6,
right_specification: f7,
eligibility_extension: f8,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(73)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
if let Some(v) = &self.no_fee_to_use {
w.key(1362)?;
w.boolean(*v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if let Some(v) = &self.priority {
w.key(1649)?;
w.integer(*v)?;
}
if let Some(v) = &self.combinable {
w.key(415)?;
w.boolean(*v)?;
}
if !self.qualification.is_empty() {
w.key(1781)?;
w.begin_array()?;
for v in &self.qualification {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.rate_discount {
w.key(1789)?;
v.write_json(w, None)?;
}
if !self.right_specification.is_empty() {
w.key(1902)?;
w.begin_array()?;
for v in &self.right_specification {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.eligibility_extension {
w.key(128)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:ExternalIdentifier`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ExternalIdentifier {
/// XML element `afac:identifier`.
pub identifier: Option<String>,
/// XML element `afac:typeOfIdentifier`.
pub type_of_identifier: Option<TypeOfIdentifierEnum>,
/// XML element `afac:otherTypeOfIdentifier`.
pub other_type_of_identifier: Option<String>,
/// XML element `afac:_externalIdentifierExtension`.
pub external_identifier_extension: Option<Box<Extension>>,
}
impl ExternalIdentifier {
const FIELDS: &'static [u32] = &[0x208ac, 0x20c60, 0x20a33, 0x204b4];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200af);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x208ac => { let v = r.string()?; r.set(&mut e0, v, 2220); }
0x20c60 => { let v = r.enumeration::<TypeOfIdentifierEnum>()?; r.set(&mut e1, v, 3168); }
0x20a33 => { let v = r.string()?; r.set(&mut e2, v, 2611); }
0x204b4 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1204); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2220);
let v = Self {
identifier: e0,
type_of_identifier: e1,
other_type_of_identifier: e2,
external_identifier_extension: e3,
};
r.close();
Ok(v)
}
}
impl ExternalIdentifier {
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.identifier {
Some(v) => { w.max_len("identifier", v, 1024)?; w.leaf("afac:identifier", v)?; }
None => return Err(w.missing("afac:identifier")),
}
if let Some(v) = &self.type_of_identifier { w.enumeration("afac:typeOfIdentifier", v.literal())?; }
if let Some(v) = &self.other_type_of_identifier { w.max_len("otherTypeOfIdentifier", v, 1024)?; w.leaf("afac:otherTypeOfIdentifier", v)?; }
if let Some(v) = &self.external_identifier_extension { w.extension("afac:_externalIdentifierExtension", v)?; }
w.end(tag)
}
}
impl ExternalIdentifier {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
965 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2498 => if r.first(&mut seen[1])? { f1 = r.enumeration::<TypeOfIdentifierEnum>()?; },
1510 => if r.first(&mut seen[2])? { f2 = r.string()?; },
129 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 965);
Ok(Self {
identifier: f0,
type_of_identifier: f1,
other_type_of_identifier: f2,
external_identifier_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(76)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.identifier {
Some(v) => {
w.key(965)?;
w.max_len("identifier", v, 1024)?; w.string(v)?;
}
None => w.absent(965, w.missing("identifier"))?,
}
if let Some(v) = &self.type_of_identifier {
w.key(2498)?;
w.enumeration(135, v.literal())?;
}
if let Some(v) = &self.other_type_of_identifier {
w.key(1510)?;
w.max_len("otherTypeOfIdentifier", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.external_identifier_extension {
w.key(129)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:FacilityObjectStatus`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FacilityObjectStatus {
/// XML element `afac:reference`.
pub reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:openingStatus`.
pub opening_status: Option<OpeningStatusEnum>,
/// XML element `afac:operationStatus`.
pub operation_status: Option<OperationStatusEnum>,
/// XML element `afac:regularOperatingHoursInForce`.
pub regular_operating_hours_in_force: Option<com::Boolean>,
/// XML element `afac:statusDescription`.
pub status_description: Option<MultilingualString>,
/// XML element `afac:newOperatingHours`.
pub new_operating_hours: Option<OperatingHours>,
/// XML element `afac:newRates`.
pub new_rates: Option<Rates>,
/// XML element `afac:fault`.
pub fault: Option<com::AnyFault>,
/// XML element `afac:_facilityObjectStatusExtension`.
pub facility_object_status_extension: Option<Box<Extension>>,
}
impl FacilityObjectStatus {
const FIELDS: &'static [u32] = &[0x20b01, 0x208f8, 0x209ec, 0x20a13, 0x20b13, 0x20bd2, 0x2099a, 0x2099b, 0x20849, 0x204b8];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200b4);
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20b01 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2817); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e1, v, 2296); }
0x209ec => { let v = r.enumeration::<OpeningStatusEnum>()?; r.set(&mut e2, v, 2540); }
0x20a13 => { let v = r.enumeration::<OperationStatusEnum>()?; r.set(&mut e3, v, 2579); }
0x20b13 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2835); }
0x20bd2 => { let v = r.multilingual()?; r.set(&mut e5, v, 3026); }
0x2099a => { let v = OperatingHours::read(r)?; r.set(&mut e6, v, 2458); }
0x2099b => { let v = Rates::read(r)?; r.set(&mut e7, v, 2459); }
0x20849 => { let v = com::AnyFault::read(r)?; r.set(&mut e8, v, 2121); }
0x204b8 => { let v = r.raw()?; r.set(&mut e9, v.map(Box::new), 1208); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2817);
let v = Self {
reference: e0,
last_updated: e1,
opening_status: e2,
operation_status: e3,
regular_operating_hours_in_force: e4,
status_description: e5,
new_operating_hours: e6,
new_rates: e7,
fault: e8,
facility_object_status_extension: e9,
};
r.close();
Ok(v)
}
}
impl FacilityObjectStatus {
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.reference {
Some(v) => { v.write(w, "afac:reference", "", " targetClass=\"afac:FacilityObject\"")?; }
None => return Err(w.missing("afac:reference")),
}
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.opening_status { w.enumeration("afac:openingStatus", v.literal())?; }
if let Some(v) = &self.operation_status { w.enumeration("afac:operationStatus", v.literal())?; }
if let Some(v) = &self.regular_operating_hours_in_force { w.leaf("afac:regularOperatingHoursInForce", v)?; }
if let Some(v) = &self.status_description { w.multilingual("afac:statusDescription", v)?; }
if let Some(v) = &self.new_operating_hours { v.write(w, "afac:newOperatingHours")?; }
if let Some(v) = &self.new_rates { v.write(w, "afac:newRates")?; }
if let Some(v) = &self.fault { v.write(w, "afac:fault")?; }
if let Some(v) = &self.facility_object_status_extension { w.extension("afac:_facilityObjectStatusExtension", v)?; }
w.end(tag)
}
}
impl FacilityObjectStatus {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 10];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1817 => if r.first(&mut seen[0])? { f0 = com::VersionedReference::read_json(r)?.map(Box::new); },
1043 => if r.first(&mut seen[1])? { f1 = r.date_time()?; },
1440 => if r.first(&mut seen[2])? { f2 = r.enumeration::<OpeningStatusEnum>()?; },
1479 => if r.first(&mut seen[3])? { f3 = r.enumeration::<OperationStatusEnum>()?; },
1835 => if r.first(&mut seen[4])? { f4 = r.boolean()?; },
2191 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
1358 => if r.first(&mut seen[6])? { f6 = OperatingHours::read_json(r)?; },
1359 => if r.first(&mut seen[7])? { f7 = Rates::read_json(r)?; },
831 => if r.first(&mut seen[8])? { f8 = com::AnyFault::read_json(r)?; },
132 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1817);
Ok(Self {
reference: f0,
last_updated: f1,
opening_status: f2,
operation_status: f3,
regular_operating_hours_in_force: f4,
status_description: f5,
new_operating_hours: f6,
new_rates: f7,
fault: f8,
facility_object_status_extension: f9,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(77)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.reference {
Some(v) => {
w.key(1817)?;
v.write_json(w, Some("FacilityObject"))?;
}
None => w.absent(1817, w.missing("reference"))?,
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.opening_status {
w.key(1440)?;
w.enumeration(88, v.literal())?;
}
if let Some(v) = &self.operation_status {
w.key(1479)?;
w.enumeration(94, v.literal())?;
}
if let Some(v) = &self.regular_operating_hours_in_force {
w.key(1835)?;
w.boolean(*v)?;
}
if let Some(v) = &self.status_description {
w.key(2191)?;
w.multilingual(v)?;
}
if let Some(v) = &self.new_operating_hours {
w.key(1358)?;
v.write_json(w)?;
}
if let Some(v) = &self.new_rates {
w.key(1359)?;
v.write_json(w)?;
}
if let Some(v) = &self.fault {
w.key(831)?;
v.write_json(w)?;
}
if let Some(v) = &self.facility_object_status_extension {
w.key(132)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:FacilityStatus`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FacilityStatus {
/// XML element `afac:reference`.
pub reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:openingStatus`.
pub opening_status: Option<OpeningStatusEnum>,
/// XML element `afac:operationStatus`.
pub operation_status: Option<OperationStatusEnum>,
/// XML element `afac:regularOperatingHoursInForce`.
pub regular_operating_hours_in_force: Option<com::Boolean>,
/// XML element `afac:statusDescription`.
pub status_description: Option<MultilingualString>,
/// XML element `afac:newOperatingHours`.
pub new_operating_hours: Option<OperatingHours>,
/// XML element `afac:newRates`.
pub new_rates: Option<Rates>,
/// XML element `afac:fault`.
pub fault: Option<com::AnyFault>,
/// XML element `afac:_facilityObjectStatusExtension`.
pub facility_object_status_extension: Option<Box<Extension>>,
/// XML element `afac:supplementalFacilityStatus`.
pub supplemental_facility_status: Vec<SupplementalFacilityStatus>,
/// XML element `afac:_facilityStatusExtension`.
pub facility_status_extension: Option<Box<Extension>>,
}
impl FacilityStatus {
const FIELDS: &'static [u32] = &[0x20b01, 0x208f8, 0x209ec, 0x20a13, 0x20b13, 0x20bd2, 0x2099a, 0x2099b, 0x20849, 0x204b8, 0x20bef, 0x204b9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200b5);
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = Vec::new();
let mut e11 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20b01 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2817); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e1, v, 2296); }
0x209ec => { let v = r.enumeration::<OpeningStatusEnum>()?; r.set(&mut e2, v, 2540); }
0x20a13 => { let v = r.enumeration::<OperationStatusEnum>()?; r.set(&mut e3, v, 2579); }
0x20b13 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2835); }
0x20bd2 => { let v = r.multilingual()?; r.set(&mut e5, v, 3026); }
0x2099a => { let v = OperatingHours::read(r)?; r.set(&mut e6, v, 2458); }
0x2099b => { let v = Rates::read(r)?; r.set(&mut e7, v, 2459); }
0x20849 => { let v = com::AnyFault::read(r)?; r.set(&mut e8, v, 2121); }
0x204b8 => { let v = r.raw()?; r.set(&mut e9, v.map(Box::new), 1208); }
0x20bef => { let v = Some(SupplementalFacilityStatus::read(r)?); e10.extend(v); }
0x204b9 => { let v = r.raw()?; r.set(&mut e11, v.map(Box::new), 1209); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2817);
let v = Self {
reference: e0,
last_updated: e1,
opening_status: e2,
operation_status: e3,
regular_operating_hours_in_force: e4,
status_description: e5,
new_operating_hours: e6,
new_rates: e7,
fault: e8,
facility_object_status_extension: e9,
supplemental_facility_status: e10,
facility_status_extension: e11,
};
r.close();
Ok(v)
}
}
impl FacilityStatus {
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.reference {
Some(v) => { v.write(w, "afac:reference", "", " targetClass=\"afac:FacilityObject\"")?; }
None => return Err(w.missing("afac:reference")),
}
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.opening_status { w.enumeration("afac:openingStatus", v.literal())?; }
if let Some(v) = &self.operation_status { w.enumeration("afac:operationStatus", v.literal())?; }
if let Some(v) = &self.regular_operating_hours_in_force { w.leaf("afac:regularOperatingHoursInForce", v)?; }
if let Some(v) = &self.status_description { w.multilingual("afac:statusDescription", v)?; }
if let Some(v) = &self.new_operating_hours { v.write(w, "afac:newOperatingHours")?; }
if let Some(v) = &self.new_rates { v.write(w, "afac:newRates")?; }
if let Some(v) = &self.fault { v.write(w, "afac:fault")?; }
if let Some(v) = &self.facility_object_status_extension { w.extension("afac:_facilityObjectStatusExtension", v)?; }
for v in &self.supplemental_facility_status { v.write(w, "afac:supplementalFacilityStatus", "", "")?; }
if let Some(v) = &self.facility_status_extension { w.extension("afac:_facilityStatusExtension", v)?; }
w.end(tag)
}
}
impl FacilityStatus {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = Vec::new();
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1817 => if r.first(&mut seen[0])? { f0 = com::VersionedReference::read_json(r)?.map(Box::new); },
1043 => if r.first(&mut seen[1])? { f1 = r.date_time()?; },
1440 => if r.first(&mut seen[2])? { f2 = r.enumeration::<OpeningStatusEnum>()?; },
1479 => if r.first(&mut seen[3])? { f3 = r.enumeration::<OperationStatusEnum>()?; },
1835 => if r.first(&mut seen[4])? { f4 = r.boolean()?; },
2191 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
1358 => if r.first(&mut seen[6])? { f6 = OperatingHours::read_json(r)?; },
1359 => if r.first(&mut seen[7])? { f7 = Rates::read_json(r)?; },
831 => if r.first(&mut seen[8])? { f8 = com::AnyFault::read_json(r)?; },
132 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
2219 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = SupplementalFacilityStatus::read_json(r)? { f10.push(v); } } },
133 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1817);
Ok(Self {
reference: f0,
last_updated: f1,
opening_status: f2,
operation_status: f3,
regular_operating_hours_in_force: f4,
status_description: f5,
new_operating_hours: f6,
new_rates: f7,
fault: f8,
facility_object_status_extension: f9,
supplemental_facility_status: f10,
facility_status_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(78)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.reference {
Some(v) => {
w.key(1817)?;
v.write_json(w, Some("FacilityObject"))?;
}
None => w.absent(1817, w.missing("reference"))?,
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.opening_status {
w.key(1440)?;
w.enumeration(88, v.literal())?;
}
if let Some(v) = &self.operation_status {
w.key(1479)?;
w.enumeration(94, v.literal())?;
}
if let Some(v) = &self.regular_operating_hours_in_force {
w.key(1835)?;
w.boolean(*v)?;
}
if let Some(v) = &self.status_description {
w.key(2191)?;
w.multilingual(v)?;
}
if let Some(v) = &self.new_operating_hours {
w.key(1358)?;
v.write_json(w)?;
}
if let Some(v) = &self.new_rates {
w.key(1359)?;
v.write_json(w)?;
}
if let Some(v) = &self.fault {
w.key(831)?;
v.write_json(w)?;
}
if let Some(v) = &self.facility_object_status_extension {
w.key(132)?;
w.extension(v)?;
}
if !self.supplemental_facility_status.is_empty() {
w.key(2219)?;
w.begin_array()?;
for v in &self.supplemental_facility_status {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.facility_status_extension {
w.key(133)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:FreeOfCharge`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FreeOfCharge {
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:_freeOfChargeExtension`.
pub free_of_charge_extension: Option<Box<Extension>>,
}
impl FreeOfCharge {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x204be];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200ba);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x204be => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1214); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
free_of_charge_extension: e4,
};
r.close();
Ok(v)
}
}
impl FreeOfCharge {
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)?;
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
if let Some(v) = &self.free_of_charge_extension { w.extension("afac:_freeOfChargeExtension", v)?; }
w.end(tag)
}
}
impl FreeOfCharge {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
243 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
1545 => if r.first(&mut seen[1])? { f1 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
135 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment: f1,
overall_period: f2,
rates_extension: f3,
free_of_charge_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(80)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
if let Some(v) = &self.free_of_charge_extension {
w.key(135)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:GeneralRateInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GeneralRateInformation {
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:_generalRateInformationExtension`.
pub general_rate_information_extension: Option<Box<Extension>>,
}
impl GeneralRateInformation {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x204cb];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200c7);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x204cb => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1227); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
general_rate_information_extension: e4,
};
r.close();
Ok(v)
}
}
impl GeneralRateInformation {
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)?;
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
if let Some(v) = &self.general_rate_information_extension { w.extension("afac:_generalRateInformationExtension", v)?; }
w.end(tag)
}
}
impl GeneralRateInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
243 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
1545 => if r.first(&mut seen[1])? { f1 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
137 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment: f1,
overall_period: f2,
rates_extension: f3,
general_rate_information_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(81)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
if let Some(v) = &self.general_rate_information_extension {
w.key(137)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Image`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Image {
/// XML element `afac:imageData`.
pub image_data: Option<com::Base64Binary>,
/// XML element `afac:imageFormat`.
pub image_format: Option<ImageFormatEnum>,
/// XML element `afac:_imageExtension`.
pub image_extension: Option<Box<Extension>>,
}
impl Image {
const FIELDS: &'static [u32] = &[0x208b2, 0x208b3, 0x204e5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200e0);
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 {
0x208b2 => { let v = r.base64()?; r.set(&mut e0, v, 2226); }
0x208b3 => { let v = r.enumeration::<ImageFormatEnum>()?; r.set(&mut e1, v, 2227); }
0x204e5 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1253); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2226);
r.required(&e1, 2227);
let v = Self {
image_data: e0,
image_format: e1,
image_extension: e2,
};
r.close();
Ok(v)
}
}
impl Image {
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.image_data {
Some(v) => { w.leaf("afac:imageData", v)?; }
None => return Err(w.missing("afac:imageData")),
}
match &self.image_format {
Some(v) => { w.enumeration("afac:imageFormat", v.literal())?; }
None => return Err(w.missing("afac:imageFormat")),
}
if let Some(v) = &self.image_extension { w.extension("afac:_imageExtension", v)?; }
w.end(tag)
}
}
impl Image {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
971 => if r.first(&mut seen[0])? { f0 = r.base64()?; },
972 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ImageFormatEnum>()?; },
138 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 971);
r.required(&f1, 972);
Ok(Self {
image_data: f0,
image_format: f1,
image_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(82)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.image_data {
Some(v) => {
w.key(971)?;
w.base64(v)?;
}
None => w.absent(971, w.missing("imageData"))?,
}
match &self.image_format {
Some(v) => {
w.key(972)?;
w.enumeration(83, v.literal())?;
}
None => w.absent(972, w.missing("imageFormat"))?,
}
if let Some(v) = &self.image_extension {
w.key(138)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:LinkedRightSpecification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinkedRightSpecification {
/// XML element `afac:qualifyingRightSpec`.
pub qualifying_right_spec: Option<Box<com::VersionedReference>>,
/// XML element `afac:assignedRightTimeRelative`.
pub assigned_right_time_relative: Option<AssignedRightTimeRelative>,
/// XML element `afac:_linkedRightSpecificationExtension`.
pub linked_right_specification_extension: Option<Box<Extension>>,
}
impl LinkedRightSpecification {
const FIELDS: &'static [u32] = &[0x20ade, 0x206f9, 0x204fe];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x200fb);
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 {
0x20ade => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2782); }
0x206f9 => { let v = AssignedRightTimeRelative::read(r)?; r.set(&mut e1, v, 1785); }
0x204fe => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1278); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
qualifying_right_spec: e0,
assigned_right_time_relative: e1,
linked_right_specification_extension: e2,
};
r.close();
Ok(v)
}
}
impl LinkedRightSpecification {
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.qualifying_right_spec { v.write(w, "afac:qualifyingRightSpec", "", " targetClass=\"afac:RightSpecification\"")?; }
if let Some(v) = &self.assigned_right_time_relative { v.write(w, "afac:assignedRightTimeRelative")?; }
if let Some(v) = &self.linked_right_specification_extension { w.extension("afac:_linkedRightSpecificationExtension", v)?; }
w.end(tag)
}
}
impl LinkedRightSpecification {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1782 => if r.first(&mut seen[0])? { f0 = com::VersionedReference::read_json(r)?.map(Box::new); },
260 => if r.first(&mut seen[1])? { f1 = AssignedRightTimeRelative::read_json(r)?; },
139 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
qualifying_right_spec: f0,
assigned_right_time_relative: f1,
linked_right_specification_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(84)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.qualifying_right_spec {
w.key(1782)?;
v.write_json(w, Some("RightSpecification"))?;
}
if let Some(v) = &self.assigned_right_time_relative {
w.key(260)?;
v.write_json(w)?;
}
if let Some(v) = &self.linked_right_specification_extension {
w.key(139)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:NutsArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NutsArea {
/// XML element `afac:nutsCodeType`.
pub nuts_code_type: Option<loc::NutsCodeTypeEnum>,
/// XML element `afac:nutsCode`.
pub nuts_code: Option<loc::NutsCode>,
/// XML element `afac:_nutsAreaExtension`.
pub nuts_area_extension: Option<Box<Extension>>,
}
impl NutsArea {
const FIELDS: &'static [u32] = &[0x209d9, 0x209d8, 0x2052d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2012e);
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 {
0x209d9 => { let v = r.enumeration::<loc::NutsCodeTypeEnum>()?; r.set(&mut e0, v, 2521); }
0x209d8 => { let v = r.string()?; r.set(&mut e1, v, 2520); }
0x2052d => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1325); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2521);
r.required(&e1, 2520);
let v = Self {
nuts_code_type: e0,
nuts_code: e1,
nuts_area_extension: e2,
};
r.close();
Ok(v)
}
}
impl NutsArea {
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.nuts_code_type {
Some(v) => { w.enumeration("afac:nutsCodeType", v.literal())?; }
None => return Err(w.missing("afac:nutsCodeType")),
}
match &self.nuts_code {
Some(v) => { w.max_len("nutsCode", v, 5)?; w.leaf("afac:nutsCode", v)?; }
None => return Err(w.missing("afac:nutsCode")),
}
if let Some(v) = &self.nuts_area_extension { w.extension("afac:_nutsAreaExtension", v)?; }
w.end(tag)
}
}
impl NutsArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<loc::NutsCodeTypeEnum>()?; },
1420 => if r.first(&mut seen[1])? { f1 = r.string()?; },
140 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1244 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1421);
r.required(&f1, 1420);
Ok(Self {
nuts_code_type: f0,
nuts_code: f1,
nuts_area_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(86)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.nuts_code_type {
Some(v) => {
w.key(1421)?;
w.enumeration(547, v.literal())?;
}
None => w.absent(1421, w.missing("nutsCodeType"))?,
}
match &self.nuts_code {
Some(v) => {
w.key(1420)?;
w.max_len("nutsCode", v, 5)?; w.string(v)?;
}
None => w.absent(1420, w.missing("nutsCode"))?,
}
if let Some(v) = &self.nuts_area_extension {
w.key(140)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OpenAllHours`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenAllHours {
/// XML element `afac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `afac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `afac:_openAllHoursExtension`.
pub open_all_hours_extension: Option<Box<Extension>>,
}
impl OpenAllHours {
const FIELDS: &'static [u32] = &[0x2074a, 0x2054d, 0x20536];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20137);
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 {
0x2074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0x2054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0x20536 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1334); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
closure_information: e0,
operating_hours_extension: e1,
open_all_hours_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenAllHours {
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.closure_information { v.write(w, "afac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("afac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.open_all_hours_extension { w.extension("afac:_openAllHoursExtension", v)?; }
w.end(tag)
}
}
impl OpenAllHours {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
344 => if r.first(&mut seen[0])? { f0 = ClosureInformation::read_json(r)?.map(Box::new); },
145 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
142 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
closure_information: f0,
operating_hours_extension: f1,
open_all_hours_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(87)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.closure_information {
w.key(344)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.operating_hours_extension {
w.key(145)?;
w.extension(v)?;
}
if let Some(v) = &self.open_all_hours_extension {
w.key(142)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OperatingHoursByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OperatingHoursByReference {
/// XML element `afac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `afac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `afac:operatingHoursReference`.
pub operating_hours_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:operatingHoursTableReference`.
pub operating_hours_table_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:_operatingHoursByReferenceExtension`.
pub operating_hours_by_reference_extension: Option<Box<Extension>>,
}
impl OperatingHoursByReference {
const FIELDS: &'static [u32] = &[0x2074a, 0x2054d, 0x20a0a, 0x20a0d, 0x2054c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2014e);
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 {
0x2074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0x2054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0x20a0a => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e2, v.map(Box::new), 2570); }
0x20a0d => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e3, v.map(Box::new), 2573); }
0x2054c => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1356); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2570);
let v = Self {
closure_information: e0,
operating_hours_extension: e1,
operating_hours_reference: e2,
operating_hours_table_reference: e3,
operating_hours_by_reference_extension: e4,
};
r.close();
Ok(v)
}
}
impl OperatingHoursByReference {
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.closure_information { v.write(w, "afac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("afac:_operatingHoursExtension", v)?; }
match &self.operating_hours_reference {
Some(v) => { v.write(w, "afac:operatingHoursReference", "", " targetClass=\"afac:OperatingHoursSpecification\"")?; }
None => return Err(w.missing("afac:operatingHoursReference")),
}
if let Some(v) = &self.operating_hours_table_reference { v.write(w, "afac:operatingHoursTableReference", "", " targetClass=\"afac:OperatingHoursTable\"")?; }
if let Some(v) = &self.operating_hours_by_reference_extension { w.extension("afac:_operatingHoursByReferenceExtension", v)?; }
w.end(tag)
}
}
impl OperatingHoursByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
344 => if r.first(&mut seen[0])? { f0 = ClosureInformation::read_json(r)?.map(Box::new); },
145 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1470 => if r.first(&mut seen[2])? { f2 = com::VersionedReference::read_json(r)?.map(Box::new); },
1473 => if r.first(&mut seen[3])? { f3 = com::VersionedReference::read_json(r)?.map(Box::new); },
144 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 1470);
Ok(Self {
closure_information: f0,
operating_hours_extension: f1,
operating_hours_reference: f2,
operating_hours_table_reference: f3,
operating_hours_by_reference_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(89)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.closure_information {
w.key(344)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.operating_hours_extension {
w.key(145)?;
w.extension(v)?;
}
match &self.operating_hours_reference {
Some(v) => {
w.key(1470)?;
v.write_json(w, Some("OperatingHoursSpecification"))?;
}
None => w.absent(1470, w.missing("operatingHoursReference"))?,
}
if let Some(v) = &self.operating_hours_table_reference {
w.key(1473)?;
v.write_json(w, Some("OperatingHoursTable"))?;
}
if let Some(v) = &self.operating_hours_by_reference_extension {
w.key(144)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OperatingHoursPublication`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OperatingHoursPublication {
/// XML attribute `lang`.
pub lang: Option<com::Language>,
/// XML attribute `extensionName`.
pub extension_name: Option<String>,
/// XML attribute `extensionVersion`.
pub extension_version: Option<String>,
/// XML attribute `profileName`.
pub profile_name: Option<String>,
/// XML attribute `profileVersion`.
pub profile_version: Option<String>,
/// XML element `com:feedDescription`.
pub feed_description: Option<MultilingualString>,
/// XML element `com:feedType`.
pub feed_type: Option<String>,
/// XML element `com:publicationTime`.
pub publication_time: Option<DateTime>,
/// XML element `com:publicationCreator`.
pub publication_creator: Option<Box<com::InternationalIdentifier>>,
/// XML element `com:_payloadPublicationExtension`.
pub payload_publication_extension: Option<Box<Extension>>,
/// XML element `afac:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `afac:operatingHoursTable`.
pub operating_hours_table: Vec<OperatingHoursTable>,
/// XML element `afac:_operatingHoursPublicationExtension`.
pub operating_hours_publication_extension: Option<Box<Extension>>,
}
impl OperatingHoursPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0x20893, 0x20a0c, 0x2054e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2014f);
let a0 = r.req_attr(2285);
let _ = r.attr(2439);
let a2 = r.attr(2104);
let a3 = r.attr(2105);
let a4 = r.attr(2760);
let a5 = r.attr(2761);
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 = Vec::new();
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40859 => { let v = r.multilingual()?; r.set(&mut e0, v, 2137); }
0x4085a => { let v = r.string()?; r.set(&mut e1, v, 2138); }
0x40adb => { let v = r.date_time()?; r.set(&mut e2, v, 2779); }
0x40ada => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2778); }
0x4056a => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1386); }
0x20893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0x20a0c => { let v = Some(OperatingHoursTable::read(r)?); e6.extend(v); }
0x2054e => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1358); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2779);
r.required(&e3, 2778);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
header_information: e5,
operating_hours_table: e6,
operating_hours_publication_extension: e7,
};
r.close();
Ok(v)
}
}
impl OperatingHoursPublication {
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)?; }
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)?; }
if let Some(v) = &self.header_information { v.write(w, "afac:headerInformation", "", "")?; }
w.count("afac:operatingHoursTable", self.operating_hours_table.len(), 1, usize::MAX)?;
for v in &self.operating_hours_table { v.write(w, "afac:operatingHoursTable", "", "")?; }
if let Some(v) = &self.operating_hours_publication_extension { w.extension("afac:_operatingHoursPublicationExtension", v)?; }
w.end(tag)
}
}
impl OperatingHoursPublication {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = Vec::new();
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1032 => if r.first(&mut seen[0])? { f0 = r.string()?; },
847 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
848 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1779 => if r.first(&mut seen[7])? { f7 = r.date_time()?; },
1778 => if r.first(&mut seen[8])? { f8 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
387 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
940 => if r.first(&mut seen[10])? { f10 = com::HeaderInformation::read_json(r)?.map(Box::new); },
1472 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OperatingHoursTable::read_json(r)? { f11.push(v); } } },
147 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1032);
r.required(&f7, 1779);
r.required(&f8, 1778);
Ok(Self {
lang: f0,
extension_name: f1,
extension_version: f2,
profile_name: f3,
profile_version: f4,
feed_description: f5,
feed_type: f6,
publication_time: f7,
publication_creator: f8,
payload_publication_extension: f9,
header_information: f10,
operating_hours_table: f11,
operating_hours_publication_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(91)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.lang {
Some(v) => {
w.key(1032)?;
w.pattern("lang", v, Pattern::Language)?; w.string(v)?;
}
None => w.absent(1032, w.missing_attr("lang"))?,
}
if let Some(v) = &self.feed_description {
w.key(847)?;
w.multilingual(v)?;
}
if let Some(v) = &self.feed_type {
w.key(848)?;
w.max_len("feedType", v, 1024)?; w.string(v)?;
}
match &self.publication_time {
Some(v) => {
w.key(1779)?;
w.date_time(v)?;
}
None => w.absent(1779, w.missing("publicationTime"))?,
}
match &self.publication_creator {
Some(v) => {
w.key(1778)?;
v.write_json(w, None)?;
}
None => w.absent(1778, w.missing("publicationCreator"))?,
}
if let Some(v) = &self.payload_publication_extension {
w.key(387)?;
w.extension(v)?;
}
if let Some(v) = &self.header_information {
w.key(940)?;
v.write_json(w, None)?;
}
w.count("operatingHoursTable", self.operating_hours_table.len(), 1, usize::MAX)?;
if !self.operating_hours_table.is_empty() {
w.key(1472)?;
w.begin_array()?;
for v in &self.operating_hours_table {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.operating_hours_publication_extension {
w.key(147)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OperatingHoursSpecification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OperatingHoursSpecification {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `afac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:label`.
pub label: Option<String>,
/// XML element `afac:operatingAllYear`.
pub operating_all_year: Option<com::Boolean>,
/// XML element `afac:urlLinkAddress`.
pub url_link_address: Option<com::Url>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_operatingHoursSpecificationExtension`.
pub operating_hours_specification_extension: Option<Box<Extension>>,
}
impl OperatingHoursSpecification {
const FIELDS: &'static [u32] = &[0x2074a, 0x2054d, 0x208f8, 0x208e7, 0x20a08, 0x20c71, 0x20a36, 0x2054f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20150);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
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;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0x2054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0x208e7 => { let v = r.string()?; r.set(&mut e3, v, 2279); }
0x20a08 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2568); }
0x20c71 => { let v = r.string()?; r.set(&mut e5, v, 3185); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e6, v.map(Box::new), 2614); }
0x2054f => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1359); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e6, 2614);
let v = Self {
id: a0,
version: a1,
closure_information: e0,
operating_hours_extension: e1,
last_updated: e2,
label: e3,
operating_all_year: e4,
url_link_address: e5,
overall_period: e6,
operating_hours_specification_extension: e7,
};
r.close();
Ok(v)
}
}
impl OperatingHoursSpecification {
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.closure_information { v.write(w, "afac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("afac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.label { w.max_len("label", v, 1024)?; w.leaf("afac:label", v)?; }
if let Some(v) = &self.operating_all_year { w.leaf("afac:operatingAllYear", v)?; }
if let Some(v) = &self.url_link_address { w.leaf("afac:urlLinkAddress", v)?; }
match &self.overall_period {
Some(v) => { v.write(w, "afac:overallPeriod", "", "")?; }
None => return Err(w.missing("afac:overallPeriod")),
}
if let Some(v) = &self.operating_hours_specification_extension { w.extension("afac:_operatingHoursSpecificationExtension", v)?; }
w.end(tag)
}
}
impl OperatingHoursSpecification {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 10];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
344 => if r.first(&mut seen[2])? { f2 = ClosureInformation::read_json(r)?.map(Box::new); },
145 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
1043 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
1026 => if r.first(&mut seen[5])? { f5 = r.string()?; },
1468 => if r.first(&mut seen[6])? { f6 = r.boolean()?; },
2518 => if r.first(&mut seen[7])? { f7 = r.string()?; },
1513 => if r.first(&mut seen[8])? { f8 = com::OverallPeriod::read_json(r)?.map(Box::new); },
149 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f8, 1513);
Ok(Self {
id: f0,
version: f1,
closure_information: f2,
operating_hours_extension: f3,
last_updated: f4,
label: f5,
operating_all_year: f6,
url_link_address: f7,
overall_period: f8,
operating_hours_specification_extension: f9,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(92)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.closure_information {
w.key(344)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.operating_hours_extension {
w.key(145)?;
w.extension(v)?;
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.label {
w.key(1026)?;
w.max_len("label", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.operating_all_year {
w.key(1468)?;
w.boolean(*v)?;
}
if let Some(v) = &self.url_link_address {
w.key(2518)?;
w.string(v)?;
}
match &self.overall_period {
Some(v) => {
w.key(1513)?;
v.write_json(w, None)?;
}
None => w.absent(1513, w.missing("overallPeriod"))?,
}
if let Some(v) = &self.operating_hours_specification_extension {
w.key(149)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OperatingHoursTable`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OperatingHoursTable {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:versionTime`.
pub version_time: Option<DateTime>,
/// XML element `afac:informationManager`.
pub information_manager: Option<Box<com::InternationalIdentifier>>,
/// XML element `afac:operatingHoursSpecification`.
pub operating_hours_specification: Vec<OperatingHoursSpecification>,
/// XML element `afac:_operatingHoursTableExtension`.
pub operating_hours_table_extension: Option<Box<Extension>>,
}
impl OperatingHoursTable {
const FIELDS: &'static [u32] = &[0x2098b, 0x20caf, 0x208c2, 0x20a0b, 0x20550];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20151);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0x20caf => { let v = r.date_time()?; r.set(&mut e1, v, 3247); }
0x208c2 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0x20a0b => { let v = Some(OperatingHoursSpecification::read(r)?); e3.extend(v); }
0x20550 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1360); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 3247);
let v = Self {
id: a0,
version: a1,
name: e0,
version_time: e1,
information_manager: e2,
operating_hours_specification: e3,
operating_hours_table_extension: e4,
};
r.close();
Ok(v)
}
}
impl OperatingHoursTable {
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("afac:name", v)?; }
match &self.version_time {
Some(v) => { w.leaf("afac:versionTime", v)?; }
None => return Err(w.missing("afac:versionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "afac:informationManager", "", "")?; }
w.count("afac:operatingHoursSpecification", self.operating_hours_specification.len(), 1, usize::MAX)?;
for v in &self.operating_hours_specification { v.write(w, "afac:operatingHoursSpecification", "", "")?; }
if let Some(v) = &self.operating_hours_table_extension { w.extension("afac:_operatingHoursTableExtension", v)?; }
w.end(tag)
}
}
impl OperatingHoursTable {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = Vec::new();
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1345 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
2580 => if r.first(&mut seen[3])? { f3 = r.date_time()?; },
989 => if r.first(&mut seen[4])? { f4 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
1471 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OperatingHoursSpecification::read_json(r)? { f5.push(v); } } },
150 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f3, 2580);
Ok(Self {
id: f0,
version: f1,
name: f2,
version_time: f3,
information_manager: f4,
operating_hours_specification: f5,
operating_hours_table_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(93)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
match &self.version_time {
Some(v) => {
w.key(2580)?;
w.date_time(v)?;
}
None => w.absent(2580, w.missing("versionTime"))?,
}
if let Some(v) = &self.information_manager {
w.key(989)?;
v.write_json(w, None)?;
}
w.count("operatingHoursSpecification", self.operating_hours_specification.len(), 1, usize::MAX)?;
if !self.operating_hours_specification.is_empty() {
w.key(1471)?;
w.begin_array()?;
for v in &self.operating_hours_specification {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.operating_hours_table_extension {
w.key(150)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OrganisationByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationByReference {
/// XML element `afac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `afac:organisationReference`.
pub organisation_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:organisationTableReference`.
pub organisation_table_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:_organisationByReferenceExtension`.
pub organisation_by_reference_extension: Option<Box<Extension>>,
}
impl OrganisationByReference {
const FIELDS: &'static [u32] = &[0x2087b, 0x2055a, 0x20a21, 0x20a24, 0x20559];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2015c);
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 {
0x2087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0x2055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0x20a21 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e2, v.map(Box::new), 2593); }
0x20a24 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e3, v.map(Box::new), 2596); }
0x20559 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1369); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2593);
let v = Self {
general_time_validity: e0,
organisation_extension: e1,
organisation_reference: e2,
organisation_table_reference: e3,
organisation_by_reference_extension: e4,
};
r.close();
Ok(v)
}
}
impl OrganisationByReference {
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.general_time_validity { v.write(w, "afac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("afac:_organisationExtension", v)?; }
match &self.organisation_reference {
Some(v) => { v.write(w, "afac:organisationReference", "", " targetClass=\"afac:ReferenceableOrganisation\"")?; }
None => return Err(w.missing("afac:organisationReference")),
}
if let Some(v) = &self.organisation_table_reference { v.write(w, "afac:organisationTableReference", "", " targetClass=\"afac:OrganisationTable\"")?; }
if let Some(v) = &self.organisation_by_reference_extension { w.extension("afac:_organisationByReferenceExtension", v)?; }
w.end(tag)
}
}
impl OrganisationByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
916 => if r.first(&mut seen[0])? { f0 = com::OverallPeriod::read_json(r)?.map(Box::new); },
153 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1492 => if r.first(&mut seen[2])? { f2 = com::VersionedReference::read_json(r)?.map(Box::new); },
1495 => if r.first(&mut seen[3])? { f3 = com::VersionedReference::read_json(r)?.map(Box::new); },
152 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 1492);
Ok(Self {
general_time_validity: f0,
organisation_extension: f1,
organisation_reference: f2,
organisation_table_reference: f3,
organisation_by_reference_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(95)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.general_time_validity {
w.key(916)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.organisation_extension {
w.key(153)?;
w.extension(v)?;
}
match &self.organisation_reference {
Some(v) => {
w.key(1492)?;
v.write_json(w, Some("ReferenceableOrganisation"))?;
}
None => w.absent(1492, w.missing("organisationReference"))?,
}
if let Some(v) = &self.organisation_table_reference {
w.key(1495)?;
v.write_json(w, Some("OrganisationTable"))?;
}
if let Some(v) = &self.organisation_by_reference_extension {
w.key(152)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OrganisationPublication`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationPublication {
/// XML attribute `lang`.
pub lang: Option<com::Language>,
/// XML attribute `extensionName`.
pub extension_name: Option<String>,
/// XML attribute `extensionVersion`.
pub extension_version: Option<String>,
/// XML attribute `profileName`.
pub profile_name: Option<String>,
/// XML attribute `profileVersion`.
pub profile_version: Option<String>,
/// XML element `com:feedDescription`.
pub feed_description: Option<MultilingualString>,
/// XML element `com:feedType`.
pub feed_type: Option<String>,
/// XML element `com:publicationTime`.
pub publication_time: Option<DateTime>,
/// XML element `com:publicationCreator`.
pub publication_creator: Option<Box<com::InternationalIdentifier>>,
/// XML element `com:_payloadPublicationExtension`.
pub payload_publication_extension: Option<Box<Extension>>,
/// XML element `afac:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `afac:organisationTable`.
pub organisation_table: Vec<OrganisationTable>,
/// XML element `afac:_organisationPublicationExtension`.
pub organisation_publication_extension: Option<Box<Extension>>,
}
impl OrganisationPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0x20893, 0x20a23, 0x2055b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2015d);
let a0 = r.req_attr(2285);
let _ = r.attr(2439);
let a2 = r.attr(2104);
let a3 = r.attr(2105);
let a4 = r.attr(2760);
let a5 = r.attr(2761);
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 = Vec::new();
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40859 => { let v = r.multilingual()?; r.set(&mut e0, v, 2137); }
0x4085a => { let v = r.string()?; r.set(&mut e1, v, 2138); }
0x40adb => { let v = r.date_time()?; r.set(&mut e2, v, 2779); }
0x40ada => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2778); }
0x4056a => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1386); }
0x20893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0x20a23 => { let v = Some(OrganisationTable::read(r)?); e6.extend(v); }
0x2055b => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1371); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2779);
r.required(&e3, 2778);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
header_information: e5,
organisation_table: e6,
organisation_publication_extension: e7,
};
r.close();
Ok(v)
}
}
impl OrganisationPublication {
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)?; }
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)?; }
if let Some(v) = &self.header_information { v.write(w, "afac:headerInformation", "", "")?; }
w.count("afac:organisationTable", self.organisation_table.len(), 1, usize::MAX)?;
for v in &self.organisation_table { v.write(w, "afac:organisationTable", "", "")?; }
if let Some(v) = &self.organisation_publication_extension { w.extension("afac:_organisationPublicationExtension", v)?; }
w.end(tag)
}
}
impl OrganisationPublication {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = Vec::new();
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1032 => if r.first(&mut seen[0])? { f0 = r.string()?; },
847 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
848 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1779 => if r.first(&mut seen[7])? { f7 = r.date_time()?; },
1778 => if r.first(&mut seen[8])? { f8 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
387 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
940 => if r.first(&mut seen[10])? { f10 = com::HeaderInformation::read_json(r)?.map(Box::new); },
1494 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OrganisationTable::read_json(r)? { f11.push(v); } } },
155 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1032);
r.required(&f7, 1779);
r.required(&f8, 1778);
Ok(Self {
lang: f0,
extension_name: f1,
extension_version: f2,
profile_name: f3,
profile_version: f4,
feed_description: f5,
feed_type: f6,
publication_time: f7,
publication_creator: f8,
payload_publication_extension: f9,
header_information: f10,
organisation_table: f11,
organisation_publication_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(97)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.lang {
Some(v) => {
w.key(1032)?;
w.pattern("lang", v, Pattern::Language)?; w.string(v)?;
}
None => w.absent(1032, w.missing_attr("lang"))?,
}
if let Some(v) = &self.feed_description {
w.key(847)?;
w.multilingual(v)?;
}
if let Some(v) = &self.feed_type {
w.key(848)?;
w.max_len("feedType", v, 1024)?; w.string(v)?;
}
match &self.publication_time {
Some(v) => {
w.key(1779)?;
w.date_time(v)?;
}
None => w.absent(1779, w.missing("publicationTime"))?,
}
match &self.publication_creator {
Some(v) => {
w.key(1778)?;
v.write_json(w, None)?;
}
None => w.absent(1778, w.missing("publicationCreator"))?,
}
if let Some(v) = &self.payload_publication_extension {
w.key(387)?;
w.extension(v)?;
}
if let Some(v) = &self.header_information {
w.key(940)?;
v.write_json(w, None)?;
}
w.count("organisationTable", self.organisation_table.len(), 1, usize::MAX)?;
if !self.organisation_table.is_empty() {
w.key(1494)?;
w.begin_array()?;
for v in &self.organisation_table {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.organisation_publication_extension {
w.key(155)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OrganisationTable`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationTable {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:versionTime`.
pub version_time: Option<DateTime>,
/// XML element `afac:informationManager`.
pub information_manager: Option<Box<com::InternationalIdentifier>>,
/// XML element `afac:anOrganisation`.
pub an_organisation: Vec<AnyAnOrganisation>,
/// XML element `afac:_organisationTableExtension`.
pub organisation_table_extension: Option<Box<Extension>>,
}
impl OrganisationTable {
const FIELDS: &'static [u32] = &[0x2098b, 0x20caf, 0x208c2, 0x206e3, 0x2055d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2015f);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0x20caf => { let v = r.date_time()?; r.set(&mut e1, v, 3247); }
0x208c2 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0x206e3 => { let v = AnyAnOrganisation::read(r)?; e3.extend(v); }
0x2055d => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1373); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 3247);
let v = Self {
id: a0,
version: a1,
name: e0,
version_time: e1,
information_manager: e2,
an_organisation: e3,
organisation_table_extension: e4,
};
r.close();
Ok(v)
}
}
impl OrganisationTable {
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("afac:name", v)?; }
match &self.version_time {
Some(v) => { w.leaf("afac:versionTime", v)?; }
None => return Err(w.missing("afac:versionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "afac:informationManager", "", "")?; }
w.count("afac:anOrganisation", self.an_organisation.len(), 1, usize::MAX)?;
for v in &self.an_organisation { v.write(w, "afac:anOrganisation")?; }
if let Some(v) = &self.organisation_table_extension { w.extension("afac:_organisationTableExtension", v)?; }
w.end(tag)
}
}
impl OrganisationTable {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = Vec::new();
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1345 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
2580 => if r.first(&mut seen[3])? { f3 = r.date_time()?; },
989 => if r.first(&mut seen[4])? { f4 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
238 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyAnOrganisation::read_json(r)? { f5.push(v); } } },
156 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f3, 2580);
Ok(Self {
id: f0,
version: f1,
name: f2,
version_time: f3,
information_manager: f4,
an_organisation: f5,
organisation_table_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(98)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
match &self.version_time {
Some(v) => {
w.key(2580)?;
w.date_time(v)?;
}
None => w.absent(2580, w.missing("versionTime"))?,
}
if let Some(v) = &self.information_manager {
w.key(989)?;
v.write_json(w, None)?;
}
w.count("anOrganisation", self.an_organisation.len(), 1, usize::MAX)?;
if !self.an_organisation.is_empty() {
w.key(238)?;
w.begin_array()?;
for v in &self.an_organisation {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.organisation_table_extension {
w.key(156)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:OrganisationUnit`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationUnit {
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:function`.
pub function: Vec<MultilingualString>,
/// XML element `afac:locationReference`.
pub location_reference: Option<loc::LocationReference>,
/// XML element `afac:contactInformation`.
pub contact_information: Vec<AnyContactInformation>,
/// XML element `afac:operatingHours`.
pub operating_hours: Option<OperatingHours>,
/// XML element `afac:_organisationUnitExtension`.
pub organisation_unit_extension: Option<Box<Extension>>,
}
impl OrganisationUnit {
const FIELDS: &'static [u32] = &[0x2098b, 0x20872, 0x20926, 0x20768, 0x20a09, 0x2055e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20160);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0x20872 => { let v = r.multilingual()?; e1.extend(v); }
0x20926 => { let v = loc::LocationReference::read(r)?; r.set(&mut e2, v, 2342); }
0x20768 => { let v = AnyContactInformation::read(r)?; e3.extend(v); }
0x20a09 => { let v = OperatingHours::read(r)?; r.set(&mut e4, v, 2569); }
0x2055e => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1374); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
name: e0,
function: e1,
location_reference: e2,
contact_information: e3,
operating_hours: e4,
organisation_unit_extension: e5,
};
r.close();
Ok(v)
}
}
impl OrganisationUnit {
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.name { w.multilingual("afac:name", v)?; }
for v in &self.function { w.multilingual("afac:function", v)?; }
if let Some(v) = &self.location_reference { v.write(w, "afac:locationReference")?; }
for v in &self.contact_information { v.write(w, "afac:contactInformation")?; }
if let Some(v) = &self.operating_hours { v.write(w, "afac:operatingHours")?; }
if let Some(v) = &self.organisation_unit_extension { w.extension("afac:_organisationUnitExtension", v)?; }
w.end(tag)
}
}
impl OrganisationUnit {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1345 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
907 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f1.push(v); } } },
1240 => if r.first(&mut seen[2])? { f2 = loc::LocationReference::read_json(r)?; },
454 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyContactInformation::read_json(r)? { f3.push(v); } } },
1469 => if r.first(&mut seen[4])? { f4 = OperatingHours::read_json(r)?; },
157 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
name: f0,
function: f1,
location_reference: f2,
contact_information: f3,
operating_hours: f4,
organisation_unit_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(100)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
if !self.function.is_empty() {
w.key(907)?;
w.begin_array()?;
for v in &self.function {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.location_reference {
w.key(1240)?;
v.write_json(w)?;
}
if !self.contact_information.is_empty() {
w.key(454)?;
w.begin_array()?;
for v in &self.contact_information {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.operating_hours {
w.key(1469)?;
v.write_json(w)?;
}
if let Some(v) = &self.organisation_unit_extension {
w.key(157)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Payment`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Payment {
/// XML element `afac:paymentMode`.
pub payment_mode: Vec<PaymentModeEnum>,
/// XML element `afac:paymentMeans`.
pub payment_means: Vec<MeansOfPaymentEnum>,
/// XML element `afac:otherPaymentMeans`.
pub other_payment_means: Vec<MultilingualString>,
/// XML element `afac:brandsAccepted`.
pub brands_accepted: Vec<PaymentBrandsEnum>,
/// XML element `afac:otherBrandsAccepted`.
pub other_brands_accepted: Vec<String>,
/// XML element `afac:_paymentExtension`.
pub payment_extension: Option<Box<Extension>>,
}
impl Payment {
const FIELDS: &'static [u32] = &[0x20a5a, 0x20a58, 0x20a2f, 0x20727, 0x20a2a, 0x2056b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2016d);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = Vec::new();
let mut e2 = Vec::new();
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 {
0x20a5a => { let v = r.enumeration::<PaymentModeEnum>()?; e0.extend(v); }
0x20a58 => { let v = r.enumeration::<MeansOfPaymentEnum>()?; e1.extend(v); }
0x20a2f => { let v = r.multilingual()?; e2.extend(v); }
0x20727 => { let v = r.enumeration::<PaymentBrandsEnum>()?; e3.extend(v); }
0x20a2a => { let v = r.string()?; e4.extend(v); }
0x2056b => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1387); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
payment_mode: e0,
payment_means: e1,
other_payment_means: e2,
brands_accepted: e3,
other_brands_accepted: e4,
payment_extension: e5,
};
r.close();
Ok(v)
}
}
impl Payment {
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)?;
for v in &self.payment_mode { w.enumeration("afac:paymentMode", v.literal())?; }
for v in &self.payment_means { w.enumeration("afac:paymentMeans", v.literal())?; }
for v in &self.other_payment_means { w.multilingual("afac:otherPaymentMeans", v)?; }
for v in &self.brands_accepted { w.enumeration("afac:brandsAccepted", v.literal())?; }
for v in &self.other_brands_accepted { w.max_len("otherBrandsAccepted", v, 1024)?; w.leaf("afac:otherBrandsAccepted", v)?; }
if let Some(v) = &self.payment_extension { w.extension("afac:_paymentExtension", v)?; }
w.end(tag)
}
}
impl Payment {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = Vec::new();
let mut f1 = Vec::new();
let mut f2 = Vec::new();
let mut f3 = Vec::new();
let mut f4 = Vec::new();
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1549 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<PaymentModeEnum>()? { f0.push(v); } } },
1547 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<MeansOfPaymentEnum>()? { f1.push(v); } } },
1506 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f2.push(v); } } },
306 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<PaymentBrandsEnum>()? { f3.push(v); } } },
1501 => if r.first(&mut seen[4])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f4.push(v); } } },
158 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
payment_mode: f0,
payment_means: f1,
other_payment_means: f2,
brands_accepted: f3,
other_brands_accepted: f4,
payment_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(101)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.payment_mode.is_empty() {
w.key(1549)?;
w.begin_array()?;
for v in &self.payment_mode {
w.item()?;
w.enumeration(103, v.literal())?;
}
w.end_array()?;
}
if !self.payment_means.is_empty() {
w.key(1547)?;
w.begin_array()?;
for v in &self.payment_means {
w.item()?;
w.enumeration(85, v.literal())?;
}
w.end_array()?;
}
if !self.other_payment_means.is_empty() {
w.key(1506)?;
w.begin_array()?;
for v in &self.other_payment_means {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if !self.brands_accepted.is_empty() {
w.key(306)?;
w.begin_array()?;
for v in &self.brands_accepted {
w.item()?;
w.enumeration(102, v.literal())?;
}
w.end_array()?;
}
if !self.other_brands_accepted.is_empty() {
w.key(1501)?;
w.begin_array()?;
for v in &self.other_brands_accepted {
w.item()?;
w.max_len("otherBrandsAccepted", v, 1024)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment_extension {
w.key(158)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Qualification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Qualification {
/// XML element `afac:withReservation`.
pub with_reservation: Option<com::Boolean>,
/// XML element `afac:propulsionEnergyType`.
pub propulsion_energy_type: Vec<EnergySourceEnum>,
/// XML element `afac:noFeeToUse`.
pub no_fee_to_use: Option<com::Boolean>,
/// XML element `afac:withMembership`.
pub with_membership: Option<com::Boolean>,
/// XML element `afac:membershipName`.
pub membership_name: Vec<MultilingualString>,
/// XML element `afac:memberOfOtherRateTable`.
pub member_of_other_rate_table: Option<com::Boolean>,
/// XML element `afac:rateTableMember`.
pub rate_table_member: Vec<com::VersionedReference>,
/// XML element `afac:activeAssignedRight`.
pub active_assigned_right: Option<String>,
/// XML element `afac:payment`.
pub payment: Vec<Payment>,
/// XML element `afac:vehicleCharacteristics`.
pub vehicle_characteristics: Vec<com::VehicleCharacteristics>,
/// XML element `afac:linkedRightSpecification`.
pub linked_right_specification: Option<Box<LinkedRightSpecification>>,
/// XML element `afac:userQualification`.
pub user_qualification: Vec<UserQualification>,
/// XML element `afac:_qualificationExtension`.
pub qualification_extension: Option<Box<Extension>>,
}
impl Qualification {
const FIELDS: &'static [u32] = &[0x20ce0, 0x20acc, 0x2099e, 0x20cdf, 0x20968, 0x20967, 0x20af3, 0x206ad, 0x20a56, 0x20c90, 0x20917, 0x20c7d, 0x205a5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201a8);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = None;
let mut e6 = Vec::new();
let mut e7 = None;
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = None;
let mut e11 = Vec::new();
let mut e12 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20ce0 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 3296); }
0x20acc => { let v = r.enumeration::<EnergySourceEnum>()?; e1.extend(v); }
0x2099e => { let v = r.value::<bool>()?; r.set(&mut e2, v, 2462); }
0x20cdf => { let v = r.value::<bool>()?; r.set(&mut e3, v, 3295); }
0x20968 => { let v = r.multilingual()?; e4.extend(v); }
0x20967 => { let v = r.value::<bool>()?; r.set(&mut e5, v, 2407); }
0x20af3 => { let v = Some(com::VersionedReference::read(r)?); e6.extend(v); }
0x206ad => { let v = r.string()?; r.set(&mut e7, v, 1709); }
0x20a56 => { let v = Some(Payment::read(r)?); e8.extend(v); }
0x20c90 => { let v = Some(com::VehicleCharacteristics::read(r)?); e9.extend(v); }
0x20917 => { let v = Some(LinkedRightSpecification::read(r)?); r.set(&mut e10, v.map(Box::new), 2327); }
0x20c7d => { let v = Some(UserQualification::read(r)?); e11.extend(v); }
0x205a5 => { let v = r.raw()?; r.set(&mut e12, v.map(Box::new), 1445); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
with_reservation: e0,
propulsion_energy_type: e1,
no_fee_to_use: e2,
with_membership: e3,
membership_name: e4,
member_of_other_rate_table: e5,
rate_table_member: e6,
active_assigned_right: e7,
payment: e8,
vehicle_characteristics: e9,
linked_right_specification: e10,
user_qualification: e11,
qualification_extension: e12,
};
r.close();
Ok(v)
}
}
impl Qualification {
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.with_reservation { w.leaf("afac:withReservation", v)?; }
for v in &self.propulsion_energy_type { w.enumeration("afac:propulsionEnergyType", v.literal())?; }
if let Some(v) = &self.no_fee_to_use { w.leaf("afac:noFeeToUse", v)?; }
if let Some(v) = &self.with_membership { w.leaf("afac:withMembership", v)?; }
for v in &self.membership_name { w.multilingual("afac:membershipName", v)?; }
if let Some(v) = &self.member_of_other_rate_table { w.leaf("afac:memberOfOtherRateTable", v)?; }
for v in &self.rate_table_member { v.write(w, "afac:rateTableMember", "", " targetClass=\"afac:RateTable\"")?; }
if let Some(v) = &self.active_assigned_right { w.max_len("activeAssignedRight", v, 1024)?; w.leaf("afac:activeAssignedRight", v)?; }
for v in &self.payment { v.write(w, "afac:payment", "", "")?; }
for v in &self.vehicle_characteristics { v.write(w, "afac:vehicleCharacteristics", "", "")?; }
if let Some(v) = &self.linked_right_specification { v.write(w, "afac:linkedRightSpecification", "", "")?; }
for v in &self.user_qualification { v.write(w, "afac:userQualification", "", "")?; }
if let Some(v) = &self.qualification_extension { w.extension("afac:_qualificationExtension", v)?; }
w.end(tag)
}
}
impl Qualification {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = Vec::new();
let mut f5 = None;
let mut f6 = Vec::new();
let mut f7 = None;
let mut f8 = Vec::new();
let mut f9 = Vec::new();
let mut f10 = None;
let mut f11 = Vec::new();
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2677 => if r.first(&mut seen[0])? { f0 = r.boolean()?; },
1764 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<EnergySourceEnum>()? { f1.push(v); } } },
1362 => if r.first(&mut seen[2])? { f2 = r.boolean()?; },
2676 => if r.first(&mut seen[3])? { f3 = r.boolean()?; },
1309 => if r.first(&mut seen[4])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f4.push(v); } } },
1308 => if r.first(&mut seen[5])? { f5 = r.boolean()?; },
1803 => if r.first(&mut seen[6])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::VersionedReference::read_json(r)? { f6.push(v); } } },
49 => if r.first(&mut seen[7])? { f7 = r.string()?; },
1545 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Payment::read_json(r)? { f8.push(v); } } },
2549 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::VehicleCharacteristics::read_json(r)? { f9.push(v); } } },
1074 => if r.first(&mut seen[10])? { f10 = LinkedRightSpecification::read_json(r)?.map(Box::new); },
2530 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = UserQualification::read_json(r)? { f11.push(v); } } },
159 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
with_reservation: f0,
propulsion_energy_type: f1,
no_fee_to_use: f2,
with_membership: f3,
membership_name: f4,
member_of_other_rate_table: f5,
rate_table_member: f6,
active_assigned_right: f7,
payment: f8,
vehicle_characteristics: f9,
linked_right_specification: f10,
user_qualification: f11,
qualification_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(104)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.with_reservation {
w.key(2677)?;
w.boolean(*v)?;
}
if !self.propulsion_energy_type.is_empty() {
w.key(1764)?;
w.begin_array()?;
for v in &self.propulsion_energy_type {
w.item()?;
w.enumeration(74, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.no_fee_to_use {
w.key(1362)?;
w.boolean(*v)?;
}
if let Some(v) = &self.with_membership {
w.key(2676)?;
w.boolean(*v)?;
}
if !self.membership_name.is_empty() {
w.key(1309)?;
w.begin_array()?;
for v in &self.membership_name {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.member_of_other_rate_table {
w.key(1308)?;
w.boolean(*v)?;
}
if !self.rate_table_member.is_empty() {
w.key(1803)?;
w.begin_array()?;
for v in &self.rate_table_member {
w.item()?;
v.write_json(w, Some("RateTable"))?;
}
w.end_array()?;
}
if let Some(v) = &self.active_assigned_right {
w.key(49)?;
w.max_len("activeAssignedRight", v, 1024)?; w.string(v)?;
}
if !self.payment.is_empty() {
w.key(1545)?;
w.begin_array()?;
for v in &self.payment {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.vehicle_characteristics.is_empty() {
w.key(2549)?;
w.begin_array()?;
for v in &self.vehicle_characteristics {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.linked_right_specification {
w.key(1074)?;
v.write_json(w, None)?;
}
if !self.user_qualification.is_empty() {
w.key(2530)?;
w.begin_array()?;
for v in &self.user_qualification {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.qualification_extension {
w.key(159)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateDiscount`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateDiscount {
/// XML element `afac:discountRate`.
pub discount_rate: Option<com::Percentage>,
/// XML element `afac:fixedValue`.
pub fixed_value: Option<Box<AmountInCurrency>>,
/// XML element `afac:_rateDiscountExtension`.
pub rate_discount_extension: Option<Box<Extension>>,
}
impl RateDiscount {
const FIELDS: &'static [u32] = &[0x207c4, 0x2085f, 0x205a6];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201a9);
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 {
0x207c4 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 1988); }
0x2085f => { let v = Some(AmountInCurrency::read(r)?); r.set(&mut e1, v.map(Box::new), 2143); }
0x205a6 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1446); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
discount_rate: e0,
fixed_value: e1,
rate_discount_extension: e2,
};
r.close();
Ok(v)
}
}
impl RateDiscount {
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.discount_rate { w.leaf("afac:discountRate", v)?; }
if let Some(v) = &self.fixed_value { v.write(w, "afac:fixedValue", "", "")?; }
if let Some(v) = &self.rate_discount_extension { w.extension("afac:_rateDiscountExtension", v)?; }
w.end(tag)
}
}
impl RateDiscount {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
573 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
853 => if r.first(&mut seen[1])? { f1 = AmountInCurrency::read_json(r)?.map(Box::new); },
160 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
discount_rate: f0,
fixed_value: f1,
rate_discount_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(106)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.discount_rate {
w.key(573)?;
w.float32(*v)?;
}
if let Some(v) = &self.fixed_value {
w.key(853)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rate_discount_extension {
w.key(160)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateLine`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateLine {
/// XML attribute `sequence`.
pub sequence: Option<com::Integer>,
/// XML element `afac:rateLineType`.
pub rate_line_type: Option<RateLineTypeEnum>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:durationStart`.
pub duration_start: Option<Time>,
/// XML element `afac:durationEnd`.
pub duration_end: Option<Time>,
/// XML element `afac:incrementPeriod`.
pub increment_period: Option<Duration>,
/// XML element `afac:value`.
pub value: Option<AmountOfMoney>,
/// XML element `afac:minValue`.
pub min_value: Option<AmountOfMoney>,
/// XML element `afac:maxValue`.
pub max_value: Option<AmountOfMoney>,
/// XML element `afac:usageCondition`.
pub usage_condition: Option<RateLineUsageConditionsTypeEnum>,
/// XML element `afac:usageDurationLimitation`.
pub usage_duration_limitation: Option<Duration>,
/// XML element `afac:usageCountLimitation`.
pub usage_count_limitation: Option<com::NonNegativeInteger>,
/// XML element `afac:surcharge`.
pub surcharge: Vec<Surcharge>,
/// XML element `afac:rateLineTax`.
pub rate_line_tax: Vec<RateLineTax>,
/// XML element `afac:_rateLineExtension`.
pub rate_line_extension: Option<Box<Extension>>,
}
impl RateLine {
const FIELDS: &'static [u32] = &[0x20aea, 0x207a8, 0x207dd, 0x207dc, 0x208bc, 0x20c8c, 0x20975, 0x20942, 0x20c77, 0x20c79, 0x20c78, 0x20bf7, 0x20ae9, 0x205a9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201ab);
let a0 = r.req_attr_value::<i64>(2935)?;
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = Vec::new();
let mut e12 = Vec::new();
let mut e13 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20aea => { let v = r.enumeration::<RateLineTypeEnum>()?; r.set(&mut e0, v, 2794); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e1, v, 1960); }
0x207dd => { let v = r.value::<Time>()?; r.set(&mut e2, v, 2013); }
0x207dc => { let v = r.value::<Time>()?; r.set(&mut e3, v, 2012); }
0x208bc => { let v = r.string()?; r.set(&mut e4, v, 2236); }
0x20c8c => { let v = r.value::<Decimal>()?; r.set(&mut e5, v, 3212); }
0x20975 => { let v = r.value::<Decimal>()?; r.set(&mut e6, v, 2421); }
0x20942 => { let v = r.value::<Decimal>()?; r.set(&mut e7, v, 2370); }
0x20c77 => { let v = r.enumeration::<RateLineUsageConditionsTypeEnum>()?; r.set(&mut e8, v, 3191); }
0x20c79 => { let v = r.string()?; r.set(&mut e9, v, 3193); }
0x20c78 => { let v = r.value::<u64>()?; r.set(&mut e10, v, 3192); }
0x20bf7 => { let v = Some(Surcharge::read(r)?); e11.extend(v); }
0x20ae9 => { let v = Some(RateLineTax::read(r)?); e12.extend(v); }
0x205a9 => { let v = r.raw()?; r.set(&mut e13, v.map(Box::new), 1449); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2794);
r.required(&e5, 3212);
let v = Self {
sequence: a0,
rate_line_type: e0,
description: e1,
duration_start: e2,
duration_end: e3,
increment_period: e4,
value: e5,
min_value: e6,
max_value: e7,
usage_condition: e8,
usage_duration_limitation: e9,
usage_count_limitation: e10,
surcharge: e11,
rate_line_tax: e12,
rate_line_extension: e13,
};
r.close();
Ok(v)
}
}
impl RateLine {
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.sequence {
Some(v) => { w.attr_value("sequence", v)?; }
None => return Err(w.missing_attr("sequence")),
}
match &self.rate_line_type {
Some(v) => { w.enumeration("afac:rateLineType", v.literal())?; }
None => return Err(w.missing("afac:rateLineType")),
}
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
if let Some(v) = &self.duration_start { w.leaf("afac:durationStart", v)?; }
if let Some(v) = &self.duration_end { w.leaf("afac:durationEnd", v)?; }
if let Some(v) = &self.increment_period { w.pattern("incrementPeriod", v, Pattern::Duration)?; w.leaf("afac:incrementPeriod", v)?; }
match &self.value {
Some(v) => { w.digits("value", v, 8, 2)?; w.leaf("afac:value", v)?; }
None => return Err(w.missing("afac:value")),
}
if let Some(v) = &self.min_value { w.digits("minValue", v, 8, 2)?; w.leaf("afac:minValue", v)?; }
if let Some(v) = &self.max_value { w.digits("maxValue", v, 8, 2)?; w.leaf("afac:maxValue", v)?; }
if let Some(v) = &self.usage_condition { w.enumeration("afac:usageCondition", v.literal())?; }
if let Some(v) = &self.usage_duration_limitation { w.pattern("usageDurationLimitation", v, Pattern::Duration)?; w.leaf("afac:usageDurationLimitation", v)?; }
if let Some(v) = &self.usage_count_limitation { w.leaf("afac:usageCountLimitation", v)?; }
for v in &self.surcharge { v.write(w, "afac:surcharge", "", "")?; }
for v in &self.rate_line_tax { v.write(w, "afac:rateLineTax", "", "")?; }
if let Some(v) = &self.rate_line_extension { w.extension("afac:_rateLineExtension", v)?; }
w.end(tag)
}
}
impl RateLine {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 15];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = Vec::new();
let mut f13 = Vec::new();
let mut f14 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2022 => if r.first(&mut seen[0])? { f0 = r.number::<i64>()?; },
1794 => if r.first(&mut seen[1])? { f1 = r.enumeration::<RateLineTypeEnum>()?; },
545 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
598 => if r.first(&mut seen[3])? { f3 = r.text::<Time>()?; },
597 => if r.first(&mut seen[4])? { f4 = r.text::<Time>()?; },
980 => if r.first(&mut seen[5])? { f5 = r.string()?; },
2545 => if r.first(&mut seen[6])? { f6 = r.number::<Decimal>()?; },
1323 => if r.first(&mut seen[7])? { f7 = r.number::<Decimal>()?; },
1271 => if r.first(&mut seen[8])? { f8 = r.number::<Decimal>()?; },
2524 => if r.first(&mut seen[9])? { f9 = r.enumeration::<RateLineUsageConditionsTypeEnum>()?; },
2526 => if r.first(&mut seen[10])? { f10 = r.string()?; },
2525 => if r.first(&mut seen[11])? { f11 = r.number::<u64>()?; },
2226 => if r.first(&mut seen[12])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Surcharge::read_json(r)? { f12.push(v); } } },
1793 => if r.first(&mut seen[13])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateLineTax::read_json(r)? { f13.push(v); } } },
163 => if r.first(&mut seen[14])? { f14 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2022);
r.required(&f1, 1794);
r.required(&f6, 2545);
Ok(Self {
sequence: f0,
rate_line_type: f1,
description: f2,
duration_start: f3,
duration_end: f4,
increment_period: f5,
value: f6,
min_value: f7,
max_value: f8,
usage_condition: f9,
usage_duration_limitation: f10,
usage_count_limitation: f11,
surcharge: f12,
rate_line_tax: f13,
rate_line_extension: f14,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(107)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.sequence {
Some(v) => {
w.key(2022)?;
w.integer(*v)?;
}
None => w.absent(2022, w.missing_attr("sequence"))?,
}
match &self.rate_line_type {
Some(v) => {
w.key(1794)?;
w.enumeration(111, v.literal())?;
}
None => w.absent(1794, w.missing("rateLineType"))?,
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if let Some(v) = &self.duration_start {
w.key(598)?;
w.time(v)?;
}
if let Some(v) = &self.duration_end {
w.key(597)?;
w.time(v)?;
}
if let Some(v) = &self.increment_period {
w.key(980)?;
w.pattern("incrementPeriod", v, Pattern::Duration)?; w.string(v)?;
}
match &self.value {
Some(v) => {
w.key(2545)?;
w.digits("value", v, 8, 2)?; w.decimal(v)?;
}
None => w.absent(2545, w.missing("value"))?,
}
if let Some(v) = &self.min_value {
w.key(1323)?;
w.digits("minValue", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.max_value {
w.key(1271)?;
w.digits("maxValue", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.usage_condition {
w.key(2524)?;
w.enumeration(112, v.literal())?;
}
if let Some(v) = &self.usage_duration_limitation {
w.key(2526)?;
w.pattern("usageDurationLimitation", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.usage_count_limitation {
w.key(2525)?;
w.integer(*v)?;
}
if !self.surcharge.is_empty() {
w.key(2226)?;
w.begin_array()?;
for v in &self.surcharge {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.rate_line_tax.is_empty() {
w.key(1793)?;
w.begin_array()?;
for v in &self.rate_line_tax {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.rate_line_extension {
w.key(163)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateLineCollection`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateLineCollection {
/// XML attribute `collectionSequence`.
pub collection_sequence: Option<com::Integer>,
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Option<CurrencyCode>,
/// XML element `afac:minValueCollection`.
pub min_value_collection: Option<AmountOfMoney>,
/// XML element `afac:maxValueCollection`.
pub max_value_collection: Option<AmountOfMoney>,
/// XML element `afac:validStart`.
pub valid_start: Option<DateTime>,
/// XML element `afac:validEnd`.
pub valid_end: Option<DateTime>,
/// XML element `afac:minTime`.
pub min_time: Option<Duration>,
/// XML element `afac:maxTime`.
pub max_time: Option<Duration>,
/// XML element `afac:resetTime`.
pub reset_time: Option<Time>,
/// XML element `afac:taxIncluded`.
pub tax_included: Option<com::Boolean>,
/// XML element `afac:taxRate`.
pub tax_rate: Option<com::Percentage>,
/// XML element `afac:taxValue`.
pub tax_value: Option<AmountOfMoney>,
/// XML element `afac:relativeTimes`.
pub relative_times: Option<com::Boolean>,
/// XML element `afac:rateLine`.
pub rate_line: Vec<RateLine>,
/// XML element `afac:_rateLineCollectionExtension`.
pub rate_line_collection_extension: Option<Box<Extension>>,
}
impl RateLineCollection {
const FIELDS: &'static [u32] = &[0x206e8, 0x20976, 0x20943, 0x20c84, 0x20c82, 0x20974, 0x20941, 0x20b2f, 0x20c00, 0x20c01, 0x20c02, 0x20b1f, 0x20ae7, 0x205a8];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201ac);
let a0 = r.req_attr_value::<i64>(1870)?;
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
let mut e12 = Vec::new();
let mut e13 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x206e8 => { let v = r.string()?; r.set(&mut e0, v, 1768); }
0x20976 => { let v = r.value::<Decimal>()?; r.set(&mut e1, v, 2422); }
0x20943 => { let v = r.value::<Decimal>()?; r.set(&mut e2, v, 2371); }
0x20c84 => { let v = r.date_time()?; r.set(&mut e3, v, 3204); }
0x20c82 => { let v = r.date_time()?; r.set(&mut e4, v, 3202); }
0x20974 => { let v = r.string()?; r.set(&mut e5, v, 2420); }
0x20941 => { let v = r.string()?; r.set(&mut e6, v, 2369); }
0x20b2f => { let v = r.value::<Time>()?; r.set(&mut e7, v, 2863); }
0x20c00 => { let v = r.value::<bool>()?; r.set(&mut e8, v, 3072); }
0x20c01 => { let v = r.value::<f32>()?; r.set(&mut e9, v, 3073); }
0x20c02 => { let v = r.value::<Decimal>()?; r.set(&mut e10, v, 3074); }
0x20b1f => { let v = r.value::<bool>()?; r.set(&mut e11, v, 2847); }
0x20ae7 => { let v = Some(RateLine::read(r)?); e12.extend(v); }
0x205a8 => { let v = r.raw()?; r.set(&mut e13, v.map(Box::new), 1448); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
collection_sequence: a0,
applicable_currency: e0,
min_value_collection: e1,
max_value_collection: e2,
valid_start: e3,
valid_end: e4,
min_time: e5,
max_time: e6,
reset_time: e7,
tax_included: e8,
tax_rate: e9,
tax_value: e10,
relative_times: e11,
rate_line: e12,
rate_line_collection_extension: e13,
};
r.close();
Ok(v)
}
}
impl RateLineCollection {
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.collection_sequence {
Some(v) => { w.attr_value("collectionSequence", v)?; }
None => return Err(w.missing_attr("collectionSequence")),
}
if let Some(v) = &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.min_value_collection { w.digits("minValueCollection", v, 8, 2)?; w.leaf("afac:minValueCollection", v)?; }
if let Some(v) = &self.max_value_collection { w.digits("maxValueCollection", v, 8, 2)?; w.leaf("afac:maxValueCollection", v)?; }
if let Some(v) = &self.valid_start { w.leaf("afac:validStart", v)?; }
if let Some(v) = &self.valid_end { w.leaf("afac:validEnd", v)?; }
if let Some(v) = &self.min_time { w.pattern("minTime", v, Pattern::Duration)?; w.leaf("afac:minTime", v)?; }
if let Some(v) = &self.max_time { w.pattern("maxTime", v, Pattern::Duration)?; w.leaf("afac:maxTime", v)?; }
if let Some(v) = &self.reset_time { w.leaf("afac:resetTime", v)?; }
if let Some(v) = &self.tax_included { w.leaf("afac:taxIncluded", v)?; }
if let Some(v) = &self.tax_rate { w.leaf("afac:taxRate", v)?; }
if let Some(v) = &self.tax_value { w.digits("taxValue", v, 8, 2)?; w.leaf("afac:taxValue", v)?; }
if let Some(v) = &self.relative_times { w.leaf("afac:relativeTimes", v)?; }
w.count("afac:rateLine", self.rate_line.len(), 1, usize::MAX)?;
for v in &self.rate_line { v.write(w, "afac:rateLine", "", "")?; }
if let Some(v) = &self.rate_line_collection_extension { w.extension("afac:_rateLineCollectionExtension", v)?; }
w.end(tag)
}
}
impl RateLineCollection {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 15];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = None;
let mut f13 = Vec::new();
let mut f14 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
348 => if r.first(&mut seen[0])? { f0 = r.number::<i64>()?; },
243 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1324 => if r.first(&mut seen[2])? { f2 = r.number::<Decimal>()?; },
1272 => if r.first(&mut seen[3])? { f3 = r.number::<Decimal>()?; },
2537 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
2535 => if r.first(&mut seen[5])? { f5 = r.date_time()?; },
1322 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1270 => if r.first(&mut seen[7])? { f7 = r.string()?; },
1886 => if r.first(&mut seen[8])? { f8 = r.text::<Time>()?; },
2235 => if r.first(&mut seen[9])? { f9 = r.boolean()?; },
2236 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
2237 => if r.first(&mut seen[11])? { f11 = r.number::<Decimal>()?; },
1847 => if r.first(&mut seen[12])? { f12 = r.boolean()?; },
1791 => if r.first(&mut seen[13])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateLine::read_json(r)? { f13.push(v); } } },
162 => if r.first(&mut seen[14])? { f14 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 348);
Ok(Self {
collection_sequence: f0,
applicable_currency: f1,
min_value_collection: f2,
max_value_collection: f3,
valid_start: f4,
valid_end: f5,
min_time: f6,
max_time: f7,
reset_time: f8,
tax_included: f9,
tax_rate: f10,
tax_value: f11,
relative_times: f12,
rate_line: f13,
rate_line_collection_extension: f14,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(108)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.collection_sequence {
Some(v) => {
w.key(348)?;
w.integer(*v)?;
}
None => w.absent(348, w.missing_attr("collectionSequence"))?,
}
if let Some(v) = &self.applicable_currency {
w.key(243)?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
if let Some(v) = &self.min_value_collection {
w.key(1324)?;
w.digits("minValueCollection", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.max_value_collection {
w.key(1272)?;
w.digits("maxValueCollection", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.valid_start {
w.key(2537)?;
w.date_time(v)?;
}
if let Some(v) = &self.valid_end {
w.key(2535)?;
w.date_time(v)?;
}
if let Some(v) = &self.min_time {
w.key(1322)?;
w.pattern("minTime", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.max_time {
w.key(1270)?;
w.pattern("maxTime", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.reset_time {
w.key(1886)?;
w.time(v)?;
}
if let Some(v) = &self.tax_included {
w.key(2235)?;
w.boolean(*v)?;
}
if let Some(v) = &self.tax_rate {
w.key(2236)?;
w.float32(*v)?;
}
if let Some(v) = &self.tax_value {
w.key(2237)?;
w.digits("taxValue", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.relative_times {
w.key(1847)?;
w.boolean(*v)?;
}
w.count("rateLine", self.rate_line.len(), 1, usize::MAX)?;
if !self.rate_line.is_empty() {
w.key(1791)?;
w.begin_array()?;
for v in &self.rate_line {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.rate_line_collection_extension {
w.key(162)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateLineTax`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateLineTax {
/// XML element `afac:taxValue`.
pub tax_value: Option<AmountOfMoney>,
/// XML element `afac:taxRate`.
pub tax_rate: Option<com::Percentage>,
/// XML element `afac:taxIncluded`.
pub tax_included: Option<com::Boolean>,
/// XML element `afac:trigger`.
pub trigger: Option<MultilingualString>,
/// XML element `afac:labelForDisplay`.
pub label_for_display: Option<MultilingualString>,
/// XML element `afac:_rateLineTaxExtension`.
pub rate_line_tax_extension: Option<Box<Extension>>,
}
impl RateLineTax {
const FIELDS: &'static [u32] = &[0x20c02, 0x20c01, 0x20c00, 0x20c57, 0x208e8, 0x205aa];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201ad);
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 {
0x20c02 => { let v = r.value::<Decimal>()?; r.set(&mut e0, v, 3074); }
0x20c01 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3073); }
0x20c00 => { let v = r.value::<bool>()?; r.set(&mut e2, v, 3072); }
0x20c57 => { let v = r.multilingual()?; r.set(&mut e3, v, 3159); }
0x208e8 => { let v = r.multilingual()?; r.set(&mut e4, v, 2280); }
0x205aa => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1450); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 3072);
let v = Self {
tax_value: e0,
tax_rate: e1,
tax_included: e2,
trigger: e3,
label_for_display: e4,
rate_line_tax_extension: e5,
};
r.close();
Ok(v)
}
}
impl RateLineTax {
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.tax_value { w.digits("taxValue", v, 8, 2)?; w.leaf("afac:taxValue", v)?; }
if let Some(v) = &self.tax_rate { w.leaf("afac:taxRate", v)?; }
match &self.tax_included {
Some(v) => { w.leaf("afac:taxIncluded", v)?; }
None => return Err(w.missing("afac:taxIncluded")),
}
if let Some(v) = &self.trigger { w.multilingual("afac:trigger", v)?; }
if let Some(v) = &self.label_for_display { w.multilingual("afac:labelForDisplay", v)?; }
if let Some(v) = &self.rate_line_tax_extension { w.extension("afac:_rateLineTaxExtension", v)?; }
w.end(tag)
}
}
impl RateLineTax {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2237 => if r.first(&mut seen[0])? { f0 = r.number::<Decimal>()?; },
2236 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
2235 => if r.first(&mut seen[2])? { f2 = r.boolean()?; },
2384 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1027 => if r.first(&mut seen[4])? { f4 = r.multilingual()?; },
164 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 2235);
Ok(Self {
tax_value: f0,
tax_rate: f1,
tax_included: f2,
trigger: f3,
label_for_display: f4,
rate_line_tax_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(110)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.tax_value {
w.key(2237)?;
w.digits("taxValue", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.tax_rate {
w.key(2236)?;
w.float32(*v)?;
}
match &self.tax_included {
Some(v) => {
w.key(2235)?;
w.boolean(*v)?;
}
None => w.absent(2235, w.missing("taxIncluded"))?,
}
if let Some(v) = &self.trigger {
w.key(2384)?;
w.multilingual(v)?;
}
if let Some(v) = &self.label_for_display {
w.key(1027)?;
w.multilingual(v)?;
}
if let Some(v) = &self.rate_line_tax_extension {
w.key(164)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateMatrix`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateMatrix {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:versionTime`.
pub version_time: Option<DateTime>,
/// XML element `afac:informationManager`.
pub information_manager: Option<Box<com::InternationalIdentifier>>,
/// XML element `afac:rateTable`.
pub rate_table: Vec<RateTable>,
/// XML element `afac:_rateMatrixExtension`.
pub rate_matrix_extension: Option<Box<Extension>>,
}
impl RateMatrix {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x2098b, 0x207a8, 0x20caf, 0x208c2, 0x20af2, 0x205ac];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201ae);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
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 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x2098b => { let v = r.multilingual()?; r.set(&mut e4, v, 2443); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e5, v, 1960); }
0x20caf => { let v = r.date_time()?; r.set(&mut e6, v, 3247); }
0x208c2 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e7, v.map(Box::new), 2242); }
0x20af2 => { let v = Some(RateTable::read(r)?); e8.extend(v); }
0x205ac => { let v = r.raw()?; r.set(&mut e9, v.map(Box::new), 1452); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e6, 3247);
let v = Self {
id: a0,
version: a1,
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
name: e4,
description: e5,
version_time: e6,
information_manager: e7,
rate_table: e8,
rate_matrix_extension: e9,
};
r.close();
Ok(v)
}
}
impl RateMatrix {
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")),
}
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
if let Some(v) = &self.name { w.multilingual("afac:name", v)?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
match &self.version_time {
Some(v) => { w.leaf("afac:versionTime", v)?; }
None => return Err(w.missing("afac:versionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "afac:informationManager", "", "")?; }
w.count("afac:rateTable", self.rate_table.len(), 1, usize::MAX)?;
for v in &self.rate_table { v.write(w, "afac:rateTable", "", "")?; }
if let Some(v) = &self.rate_matrix_extension { w.extension("afac:_rateMatrixExtension", v)?; }
w.end(tag)
}
}
impl RateMatrix {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = Vec::new();
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
243 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f2.push(v); } } },
1545 => if r.first(&mut seen[3])? { f3 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[4])? { f4 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
1345 => if r.first(&mut seen[6])? { f6 = r.multilingual()?; },
545 => if r.first(&mut seen[7])? { f7 = r.multilingual()?; },
2580 => if r.first(&mut seen[8])? { f8 = r.date_time()?; },
989 => if r.first(&mut seen[9])? { f9 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
1802 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateTable::read_json(r)? { f10.push(v); } } },
168 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f8, 2580);
Ok(Self {
id: f0,
version: f1,
applicable_currency: f2,
payment: f3,
overall_period: f4,
rates_extension: f5,
name: f6,
description: f7,
version_time: f8,
information_manager: f9,
rate_table: f10,
rate_matrix_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(113)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
match &self.version_time {
Some(v) => {
w.key(2580)?;
w.date_time(v)?;
}
None => w.absent(2580, w.missing("versionTime"))?,
}
if let Some(v) = &self.information_manager {
w.key(989)?;
v.write_json(w, None)?;
}
w.count("rateTable", self.rate_table.len(), 1, usize::MAX)?;
if !self.rate_table.is_empty() {
w.key(1802)?;
w.begin_array()?;
for v in &self.rate_table {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.rate_matrix_extension {
w.key(168)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateMatrixByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateMatrixByReference {
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:rateTableReference`.
pub rate_table_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:_rateMatrixByReferenceExtension`.
pub rate_matrix_by_reference_extension: Option<Box<Extension>>,
}
impl RateMatrixByReference {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x20af5, 0x205ab];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201af);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x20af5 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 2805); }
0x205ab => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1451); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2805);
let v = Self {
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
rate_table_reference: e4,
rate_matrix_by_reference_extension: e5,
};
r.close();
Ok(v)
}
}
impl RateMatrixByReference {
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)?;
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
match &self.rate_table_reference {
Some(v) => { v.write(w, "afac:rateTableReference", "", " targetClass=\"afac:RateMatrix\"")?; }
None => return Err(w.missing("afac:rateTableReference")),
}
if let Some(v) = &self.rate_matrix_by_reference_extension { w.extension("afac:_rateMatrixByReferenceExtension", v)?; }
w.end(tag)
}
}
impl RateMatrixByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
243 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
1545 => if r.first(&mut seen[1])? { f1 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
1805 => if r.first(&mut seen[4])? { f4 = com::VersionedReference::read_json(r)?.map(Box::new); },
167 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f4, 1805);
Ok(Self {
applicable_currency: f0,
payment: f1,
overall_period: f2,
rates_extension: f3,
rate_table_reference: f4,
rate_matrix_by_reference_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(114)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
match &self.rate_table_reference {
Some(v) => {
w.key(1805)?;
v.write_json(w, Some("RateMatrix"))?;
}
None => w.absent(1805, w.missing("rateTableReference"))?,
}
if let Some(v) = &self.rate_matrix_by_reference_extension {
w.key(167)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateTable`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateTable {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:rateTableName`.
pub rate_table_name: Option<MultilingualString>,
/// XML element `afac:activeTimes`.
pub active_times: Vec<Duration>,
/// XML element `afac:availability`.
pub availability: Option<RateAvailabilityTypeEnum>,
/// XML element `afac:rateResponsibleParty`.
pub rate_responsible_party: Option<Box<com::VersionedReference>>,
/// XML element `afac:rateSupersedeLink`.
pub rate_supersede_link: Option<Box<com::VersionedReference>>,
/// XML element `afac:validation`.
pub validation: Option<com::Boolean>,
/// XML element `afac:rateType`.
pub rate_type: Option<RateTypeEnum>,
/// XML element `afac:validityStart`.
pub validity_start: Option<DateTime>,
/// XML element `afac:validityEnd`.
pub validity_end: Option<DateTime>,
/// XML element `afac:additionalInformation`.
pub additional_information: Option<com::Url>,
/// XML element `afac:rateLineCollection`.
pub rate_line_collection: Vec<AnyRateLineCollection>,
/// XML element `afac:eligibility`.
pub eligibility: Option<Box<Eligibility>>,
/// XML element `afac:_rateTableExtension`.
pub rate_table_extension: Option<Box<Extension>>,
}
impl RateTable {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x208f8, 0x20af4, 0x206ae, 0x20705, 0x20af0, 0x20af1, 0x20c85, 0x20af6, 0x20c89, 0x20c88, 0x206b9, 0x20ae8, 0x207f2, 0x205ae];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201b0);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = Vec::new();
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
let mut e15 = Vec::new();
let mut e16 = None;
let mut e17 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e4, v, 2296); }
0x20af4 => { let v = r.multilingual()?; r.set(&mut e5, v, 2804); }
0x206ae => { let v = r.string()?; e6.extend(v); }
0x20705 => { let v = r.enumeration::<RateAvailabilityTypeEnum>()?; r.set(&mut e7, v, 1797); }
0x20af0 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e8, v.map(Box::new), 2800); }
0x20af1 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e9, v.map(Box::new), 2801); }
0x20c85 => { let v = r.value::<bool>()?; r.set(&mut e10, v, 3205); }
0x20af6 => { let v = r.enumeration::<RateTypeEnum>()?; r.set(&mut e11, v, 2806); }
0x20c89 => { let v = r.date_time()?; r.set(&mut e12, v, 3209); }
0x20c88 => { let v = r.date_time()?; r.set(&mut e13, v, 3208); }
0x206b9 => { let v = r.string()?; r.set(&mut e14, v, 1721); }
0x20ae8 => { let v = AnyRateLineCollection::read(r)?; e15.extend(v); }
0x207f2 => { let v = Some(Eligibility::read(r)?); r.set(&mut e16, v.map(Box::new), 2034); }
0x205ae => { let v = r.raw()?; r.set(&mut e17, v.map(Box::new), 1454); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
version: a1,
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
last_updated: e4,
rate_table_name: e5,
active_times: e6,
availability: e7,
rate_responsible_party: e8,
rate_supersede_link: e9,
validation: e10,
rate_type: e11,
validity_start: e12,
validity_end: e13,
additional_information: e14,
rate_line_collection: e15,
eligibility: e16,
rate_table_extension: e17,
};
r.close();
Ok(v)
}
}
impl RateTable {
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")),
}
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.rate_table_name { w.multilingual("afac:rateTableName", v)?; }
for v in &self.active_times { w.pattern("activeTimes", v, Pattern::Duration)?; w.leaf("afac:activeTimes", v)?; }
if let Some(v) = &self.availability { w.enumeration("afac:availability", v.literal())?; }
if let Some(v) = &self.rate_responsible_party { v.write(w, "afac:rateResponsibleParty", "", " targetClass=\"afac:ReferenceableOrganisation\"")?; }
if let Some(v) = &self.rate_supersede_link { v.write(w, "afac:rateSupersedeLink", "", " targetClass=\"afac:RateTable\"")?; }
if let Some(v) = &self.validation { w.leaf("afac:validation", v)?; }
if let Some(v) = &self.rate_type { w.enumeration("afac:rateType", v.literal())?; }
if let Some(v) = &self.validity_start { w.leaf("afac:validityStart", v)?; }
if let Some(v) = &self.validity_end { w.leaf("afac:validityEnd", v)?; }
if let Some(v) = &self.additional_information { w.leaf("afac:additionalInformation", v)?; }
for v in &self.rate_line_collection { v.write(w, "afac:rateLineCollection")?; }
if let Some(v) = &self.eligibility { v.write(w, "afac:eligibility", "", "")?; }
if let Some(v) = &self.rate_table_extension { w.extension("afac:_rateTableExtension", v)?; }
w.end(tag)
}
}
impl RateTable {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 20];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = Vec::new();
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = None;
let mut f13 = None;
let mut f14 = None;
let mut f15 = None;
let mut f16 = None;
let mut f17 = Vec::new();
let mut f18 = None;
let mut f19 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
243 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f2.push(v); } } },
1545 => if r.first(&mut seen[3])? { f3 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[4])? { f4 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
1043 => if r.first(&mut seen[6])? { f6 = r.date_time()?; },
1804 => if r.first(&mut seen[7])? { f7 = r.multilingual()?; },
50 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f8.push(v); } } },
272 => if r.first(&mut seen[9])? { f9 = r.enumeration::<RateAvailabilityTypeEnum>()?; },
1800 => if r.first(&mut seen[10])? { f10 = com::VersionedReference::read_json(r)?.map(Box::new); },
1801 => if r.first(&mut seen[11])? { f11 = com::VersionedReference::read_json(r)?.map(Box::new); },
2538 => if r.first(&mut seen[12])? { f12 = r.boolean()?; },
1806 => if r.first(&mut seen[13])? { f13 = r.enumeration::<RateTypeEnum>()?; },
2542 => if r.first(&mut seen[14])? { f14 = r.date_time()?; },
2541 => if r.first(&mut seen[15])? { f15 = r.date_time()?; },
61 => if r.first(&mut seen[16])? { f16 = r.string()?; },
1792 => if r.first(&mut seen[17])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyRateLineCollection::read_json(r)? { f17.push(v); } } },
654 => if r.first(&mut seen[18])? { f18 = Eligibility::read_json(r)?.map(Box::new); },
172 => if r.first(&mut seen[19])? { f19 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
Ok(Self {
id: f0,
version: f1,
applicable_currency: f2,
payment: f3,
overall_period: f4,
rates_extension: f5,
last_updated: f6,
rate_table_name: f7,
active_times: f8,
availability: f9,
rate_responsible_party: f10,
rate_supersede_link: f11,
validation: f12,
rate_type: f13,
validity_start: f14,
validity_end: f15,
additional_information: f16,
rate_line_collection: f17,
eligibility: f18,
rate_table_extension: f19,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(115)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.rate_table_name {
w.key(1804)?;
w.multilingual(v)?;
}
if !self.active_times.is_empty() {
w.key(50)?;
w.begin_array()?;
for v in &self.active_times {
w.item()?;
w.pattern("activeTimes", v, Pattern::Duration)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.availability {
w.key(272)?;
w.enumeration(105, v.literal())?;
}
if let Some(v) = &self.rate_responsible_party {
w.key(1800)?;
v.write_json(w, Some("ReferenceableOrganisation"))?;
}
if let Some(v) = &self.rate_supersede_link {
w.key(1801)?;
v.write_json(w, Some("RateTable"))?;
}
if let Some(v) = &self.validation {
w.key(2538)?;
w.boolean(*v)?;
}
if let Some(v) = &self.rate_type {
w.key(1806)?;
w.enumeration(117, v.literal())?;
}
if let Some(v) = &self.validity_start {
w.key(2542)?;
w.date_time(v)?;
}
if let Some(v) = &self.validity_end {
w.key(2541)?;
w.date_time(v)?;
}
if let Some(v) = &self.additional_information {
w.key(61)?;
w.string(v)?;
}
if !self.rate_line_collection.is_empty() {
w.key(1792)?;
w.begin_array()?;
for v in &self.rate_line_collection {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.eligibility {
w.key(654)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rate_table_extension {
w.key(172)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RateTableByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateTableByReference {
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:rateReference`.
pub rate_reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:_rateTableByReferenceExtension`.
pub rate_table_by_reference_extension: Option<Box<Extension>>,
}
impl RateTableByReference {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x20aef, 0x205ad];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201b1);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x20aef => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 2799); }
0x205ad => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1453); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2799);
let v = Self {
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
rate_reference: e4,
rate_table_by_reference_extension: e5,
};
r.close();
Ok(v)
}
}
impl RateTableByReference {
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)?;
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
match &self.rate_reference {
Some(v) => { v.write(w, "afac:rateReference", "", " targetClass=\"afac:RateTable\"")?; }
None => return Err(w.missing("afac:rateReference")),
}
if let Some(v) = &self.rate_table_by_reference_extension { w.extension("afac:_rateTableByReferenceExtension", v)?; }
w.end(tag)
}
}
impl RateTableByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
243 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
1545 => if r.first(&mut seen[1])? { f1 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
1799 => if r.first(&mut seen[4])? { f4 = com::VersionedReference::read_json(r)?.map(Box::new); },
171 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f4, 1799);
Ok(Self {
applicable_currency: f0,
payment: f1,
overall_period: f2,
rates_extension: f3,
rate_reference: f4,
rate_table_by_reference_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(116)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
match &self.rate_reference {
Some(v) => {
w.key(1799)?;
v.write_json(w, Some("RateTable"))?;
}
None => w.absent(1799, w.missing("rateReference"))?,
}
if let Some(v) = &self.rate_table_by_reference_extension {
w.key(171)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RatesPublication`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RatesPublication {
/// XML attribute `lang`.
pub lang: Option<com::Language>,
/// XML attribute `extensionName`.
pub extension_name: Option<String>,
/// XML attribute `extensionVersion`.
pub extension_version: Option<String>,
/// XML attribute `profileName`.
pub profile_name: Option<String>,
/// XML attribute `profileVersion`.
pub profile_version: Option<String>,
/// XML element `com:feedDescription`.
pub feed_description: Option<MultilingualString>,
/// XML element `com:feedType`.
pub feed_type: Option<String>,
/// XML element `com:publicationTime`.
pub publication_time: Option<DateTime>,
/// XML element `com:publicationCreator`.
pub publication_creator: Option<Box<com::InternationalIdentifier>>,
/// XML element `com:_payloadPublicationExtension`.
pub payload_publication_extension: Option<Box<Extension>>,
/// XML element `afac:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `afac:rateMatrix`.
pub rate_matrix: Vec<RateMatrix>,
/// XML element `afac:_ratesPublicationExtension`.
pub rates_publication_extension: Option<Box<Extension>>,
}
impl RatesPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0x20893, 0x20aeb, 0x205b1];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201b4);
let a0 = r.req_attr(2285);
let _ = r.attr(2439);
let a2 = r.attr(2104);
let a3 = r.attr(2105);
let a4 = r.attr(2760);
let a5 = r.attr(2761);
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 = Vec::new();
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40859 => { let v = r.multilingual()?; r.set(&mut e0, v, 2137); }
0x4085a => { let v = r.string()?; r.set(&mut e1, v, 2138); }
0x40adb => { let v = r.date_time()?; r.set(&mut e2, v, 2779); }
0x40ada => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2778); }
0x4056a => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1386); }
0x20893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0x20aeb => { let v = Some(RateMatrix::read(r)?); e6.extend(v); }
0x205b1 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1457); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2779);
r.required(&e3, 2778);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
header_information: e5,
rate_matrix: e6,
rates_publication_extension: e7,
};
r.close();
Ok(v)
}
}
impl RatesPublication {
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)?; }
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)?; }
if let Some(v) = &self.header_information { v.write(w, "afac:headerInformation", "", "")?; }
w.count("afac:rateMatrix", self.rate_matrix.len(), 1, usize::MAX)?;
for v in &self.rate_matrix { v.write(w, "afac:rateMatrix", "", "")?; }
if let Some(v) = &self.rates_publication_extension { w.extension("afac:_ratesPublicationExtension", v)?; }
w.end(tag)
}
}
impl RatesPublication {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = Vec::new();
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1032 => if r.first(&mut seen[0])? { f0 = r.string()?; },
847 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
848 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1779 => if r.first(&mut seen[7])? { f7 = r.date_time()?; },
1778 => if r.first(&mut seen[8])? { f8 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
387 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
940 => if r.first(&mut seen[10])? { f10 = com::HeaderInformation::read_json(r)?.map(Box::new); },
1795 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateMatrix::read_json(r)? { f11.push(v); } } },
175 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1032);
r.required(&f7, 1779);
r.required(&f8, 1778);
Ok(Self {
lang: f0,
extension_name: f1,
extension_version: f2,
profile_name: f3,
profile_version: f4,
feed_description: f5,
feed_type: f6,
publication_time: f7,
publication_creator: f8,
payload_publication_extension: f9,
header_information: f10,
rate_matrix: f11,
rates_publication_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(119)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.lang {
Some(v) => {
w.key(1032)?;
w.pattern("lang", v, Pattern::Language)?; w.string(v)?;
}
None => w.absent(1032, w.missing_attr("lang"))?,
}
if let Some(v) = &self.feed_description {
w.key(847)?;
w.multilingual(v)?;
}
if let Some(v) = &self.feed_type {
w.key(848)?;
w.max_len("feedType", v, 1024)?; w.string(v)?;
}
match &self.publication_time {
Some(v) => {
w.key(1779)?;
w.date_time(v)?;
}
None => w.absent(1779, w.missing("publicationTime"))?,
}
match &self.publication_creator {
Some(v) => {
w.key(1778)?;
v.write_json(w, None)?;
}
None => w.absent(1778, w.missing("publicationCreator"))?,
}
if let Some(v) = &self.payload_publication_extension {
w.key(387)?;
w.extension(v)?;
}
if let Some(v) = &self.header_information {
w.key(940)?;
v.write_json(w, None)?;
}
w.count("rateMatrix", self.rate_matrix.len(), 1, usize::MAX)?;
if !self.rate_matrix.is_empty() {
w.key(1795)?;
w.begin_array()?;
for v in &self.rate_matrix {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.rates_publication_extension {
w.key(175)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:ReferenceableOrganisation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ReferenceableOrganisation {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:legalName`.
pub legal_name: Option<MultilingualString>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:linkToGeneralInformation`.
pub link_to_general_information: Option<com::Url>,
/// XML element `afac:linkToLogo`.
pub link_to_logo: Option<com::Url>,
/// XML element `afac:linkToWebform`.
pub link_to_webform: Option<com::Url>,
/// XML element `afac:available24hours`.
pub available24hours: Option<com::Boolean>,
/// XML element `afac:responsibility`.
pub responsibility: Vec<MultilingualString>,
/// XML element `afac:publishingAgreement`.
pub publishing_agreement: Option<com::Boolean>,
/// XML element `afac:type`.
pub r#type: Option<OrganisationTypeEnum>,
/// XML element `afac:nationalOrganisationNumber`.
pub national_organisation_number: Option<String>,
/// XML element `afac:nationalRegister`.
pub national_register: Option<String>,
/// XML element `afac:vatIdentificationNumber`.
pub vat_identification_number: Option<String>,
/// XML element `afac:organisationUnit`.
pub organisation_unit: Vec<OrganisationUnit>,
/// XML element `afac:externalIdentifier`.
pub external_identifier: Vec<ExternalIdentifier>,
/// XML element `afac:subOrganisation`.
pub sub_organisation: Vec<Organisation>,
/// XML element `afac:_anOrganisationExtension`.
pub an_organisation_extension: Option<Box<Extension>>,
/// XML element `afac:_referenceableOrganisationExtension`.
pub referenceable_organisation_extension: Option<Box<Extension>>,
}
impl ReferenceableOrganisation {
const FIELDS: &'static [u32] = &[0x2087b, 0x2055a, 0x208f8, 0x2098b, 0x20901, 0x207a8, 0x20914, 0x20915, 0x20916, 0x20706, 0x20b37, 0x20adc, 0x20c5d, 0x20992, 0x20993, 0x20c8e, 0x20a25, 0x20840, 0x20be4, 0x20439, 0x205b3];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201b7);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = Vec::new();
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
let mut e15 = None;
let mut e16 = Vec::new();
let mut e17 = Vec::new();
let mut e18 = Vec::new();
let mut e19 = None;
let mut e20 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0x2055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0x2098b => { let v = r.multilingual()?; r.set(&mut e3, v, 2443); }
0x20901 => { let v = r.multilingual()?; r.set(&mut e4, v, 2305); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e5, v, 1960); }
0x20914 => { let v = r.string()?; r.set(&mut e6, v, 2324); }
0x20915 => { let v = r.string()?; r.set(&mut e7, v, 2325); }
0x20916 => { let v = r.string()?; r.set(&mut e8, v, 2326); }
0x20706 => { let v = r.value::<bool>()?; r.set(&mut e9, v, 1798); }
0x20b37 => { let v = r.multilingual()?; e10.extend(v); }
0x20adc => { let v = r.value::<bool>()?; r.set(&mut e11, v, 2780); }
0x20c5d => { let v = r.enumeration::<OrganisationTypeEnum>()?; r.set(&mut e12, v, 3165); }
0x20992 => { let v = r.string()?; r.set(&mut e13, v, 2450); }
0x20993 => { let v = r.string()?; r.set(&mut e14, v, 2451); }
0x20c8e => { let v = r.string()?; r.set(&mut e15, v, 3214); }
0x20a25 => { let v = Some(OrganisationUnit::read(r)?); e16.extend(v); }
0x20840 => { let v = Some(ExternalIdentifier::read(r)?); e17.extend(v); }
0x20be4 => { let v = Organisation::read(r)?; e18.extend(v); }
0x20439 => { let v = r.raw()?; r.set(&mut e19, v.map(Box::new), 1081); }
0x205b3 => { let v = r.raw()?; r.set(&mut e20, v.map(Box::new), 1459); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2443);
let v = Self {
id: a0,
version: a1,
general_time_validity: e0,
organisation_extension: e1,
last_updated: e2,
name: e3,
legal_name: e4,
description: e5,
link_to_general_information: e6,
link_to_logo: e7,
link_to_webform: e8,
available24hours: e9,
responsibility: e10,
publishing_agreement: e11,
r#type: e12,
national_organisation_number: e13,
national_register: e14,
vat_identification_number: e15,
organisation_unit: e16,
external_identifier: e17,
sub_organisation: e18,
an_organisation_extension: e19,
referenceable_organisation_extension: e20,
};
r.close();
Ok(v)
}
}
impl ReferenceableOrganisation {
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.general_time_validity { v.write(w, "afac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("afac:_organisationExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
match &self.name {
Some(v) => { w.multilingual("afac:name", v)?; }
None => return Err(w.missing("afac:name")),
}
if let Some(v) = &self.legal_name { w.multilingual("afac:legalName", v)?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
if let Some(v) = &self.link_to_general_information { w.leaf("afac:linkToGeneralInformation", v)?; }
if let Some(v) = &self.link_to_logo { w.leaf("afac:linkToLogo", v)?; }
if let Some(v) = &self.link_to_webform { w.leaf("afac:linkToWebform", v)?; }
if let Some(v) = &self.available24hours { w.leaf("afac:available24hours", v)?; }
for v in &self.responsibility { w.multilingual("afac:responsibility", v)?; }
if let Some(v) = &self.publishing_agreement { w.leaf("afac:publishingAgreement", v)?; }
if let Some(v) = &self.r#type { w.enumeration("afac:type", v.literal())?; }
if let Some(v) = &self.national_organisation_number { w.max_len("nationalOrganisationNumber", v, 1024)?; w.leaf("afac:nationalOrganisationNumber", v)?; }
if let Some(v) = &self.national_register { w.max_len("nationalRegister", v, 1024)?; w.leaf("afac:nationalRegister", v)?; }
if let Some(v) = &self.vat_identification_number { w.max_len("vatIdentificationNumber", v, 1024)?; w.leaf("afac:vatIdentificationNumber", v)?; }
for v in &self.organisation_unit { v.write(w, "afac:organisationUnit", "", "")?; }
for v in &self.external_identifier { v.write(w, "afac:externalIdentifier", "", "")?; }
for v in &self.sub_organisation { v.write(w, "afac:subOrganisation")?; }
if let Some(v) = &self.an_organisation_extension { w.extension("afac:_anOrganisationExtension", v)?; }
if let Some(v) = &self.referenceable_organisation_extension { w.extension("afac:_referenceableOrganisationExtension", v)?; }
w.end(tag)
}
}
impl ReferenceableOrganisation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 23];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = Vec::new();
let mut f13 = None;
let mut f14 = None;
let mut f15 = None;
let mut f16 = None;
let mut f17 = None;
let mut f18 = Vec::new();
let mut f19 = Vec::new();
let mut f20 = Vec::new();
let mut f21 = None;
let mut f22 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
916 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
153 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
1043 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
1345 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
1052 => if r.first(&mut seen[6])? { f6 = r.multilingual()?; },
545 => if r.first(&mut seen[7])? { f7 = r.multilingual()?; },
1071 => if r.first(&mut seen[8])? { f8 = r.string()?; },
1072 => if r.first(&mut seen[9])? { f9 = r.string()?; },
1073 => if r.first(&mut seen[10])? { f10 = r.string()?; },
273 => if r.first(&mut seen[11])? { f11 = r.boolean()?; },
1894 => if r.first(&mut seen[12])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f12.push(v); } } },
1780 => if r.first(&mut seen[13])? { f13 = r.boolean()?; },
2495 => if r.first(&mut seen[14])? { f14 = r.enumeration::<OrganisationTypeEnum>()?; },
1351 => if r.first(&mut seen[15])? { f15 = r.string()?; },
1352 => if r.first(&mut seen[16])? { f16 = r.string()?; },
2547 => if r.first(&mut seen[17])? { f17 = r.string()?; },
1496 => if r.first(&mut seen[18])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OrganisationUnit::read_json(r)? { f18.push(v); } } },
739 => if r.first(&mut seen[19])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalIdentifier::read_json(r)? { f19.push(v); } } },
2208 => if r.first(&mut seen[20])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Organisation::read_json(r)? { f20.push(v); } } },
113 => if r.first(&mut seen[21])? { f21 = r.raw_object()?.map(Box::new); },
177 => if r.first(&mut seen[22])? { f22 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f5, 1345);
Ok(Self {
id: f0,
version: f1,
general_time_validity: f2,
organisation_extension: f3,
last_updated: f4,
name: f5,
legal_name: f6,
description: f7,
link_to_general_information: f8,
link_to_logo: f9,
link_to_webform: f10,
available24hours: f11,
responsibility: f12,
publishing_agreement: f13,
r#type: f14,
national_organisation_number: f15,
national_register: f16,
vat_identification_number: f17,
organisation_unit: f18,
external_identifier: f19,
sub_organisation: f20,
an_organisation_extension: f21,
referenceable_organisation_extension: f22,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(120)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.general_time_validity {
w.key(916)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.organisation_extension {
w.key(153)?;
w.extension(v)?;
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
match &self.name {
Some(v) => {
w.key(1345)?;
w.multilingual(v)?;
}
None => w.absent(1345, w.missing("name"))?,
}
if let Some(v) = &self.legal_name {
w.key(1052)?;
w.multilingual(v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if let Some(v) = &self.link_to_general_information {
w.key(1071)?;
w.string(v)?;
}
if let Some(v) = &self.link_to_logo {
w.key(1072)?;
w.string(v)?;
}
if let Some(v) = &self.link_to_webform {
w.key(1073)?;
w.string(v)?;
}
if let Some(v) = &self.available24hours {
w.key(273)?;
w.boolean(*v)?;
}
if !self.responsibility.is_empty() {
w.key(1894)?;
w.begin_array()?;
for v in &self.responsibility {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.publishing_agreement {
w.key(1780)?;
w.boolean(*v)?;
}
if let Some(v) = &self.r#type {
w.key(2495)?;
w.enumeration(99, v.literal())?;
}
if let Some(v) = &self.national_organisation_number {
w.key(1351)?;
w.max_len("nationalOrganisationNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.national_register {
w.key(1352)?;
w.max_len("nationalRegister", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vat_identification_number {
w.key(2547)?;
w.max_len("vatIdentificationNumber", v, 1024)?; w.string(v)?;
}
if !self.organisation_unit.is_empty() {
w.key(1496)?;
w.begin_array()?;
for v in &self.organisation_unit {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.external_identifier.is_empty() {
w.key(739)?;
w.begin_array()?;
for v in &self.external_identifier {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.sub_organisation.is_empty() {
w.key(2208)?;
w.begin_array()?;
for v in &self.sub_organisation {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.an_organisation_extension {
w.key(113)?;
w.extension(v)?;
}
if let Some(v) = &self.referenceable_organisation_extension {
w.key(177)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RelativeOffsets`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RelativeOffsets {
/// XML element `afac:_assignedRightTimeRelativeExtension`.
pub assigned_right_time_relative_extension: Option<Box<Extension>>,
/// XML element `afac:earliestStartRelative`.
pub earliest_start_relative: Option<Duration>,
/// XML element `afac:latestStartRelative`.
pub latest_start_relative: Option<Duration>,
/// XML element `afac:earliestEndRelative`.
pub earliest_end_relative: Option<Duration>,
/// XML element `afac:latestEndRelative`.
pub latest_end_relative: Option<Duration>,
/// XML element `afac:_relativeOffsetsExtension`.
pub relative_offsets_extension: Option<Box<Extension>>,
}
impl RelativeOffsets {
const FIELDS: &'static [u32] = &[0x2043e, 0x207e8, 0x208fc, 0x207e6, 0x208fa, 0x205ba];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201be);
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 {
0x2043e => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1086); }
0x207e8 => { let v = r.string()?; r.set(&mut e1, v, 2024); }
0x208fc => { let v = r.string()?; r.set(&mut e2, v, 2300); }
0x207e6 => { let v = r.string()?; r.set(&mut e3, v, 2022); }
0x208fa => { let v = r.string()?; r.set(&mut e4, v, 2298); }
0x205ba => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1466); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
assigned_right_time_relative_extension: e0,
earliest_start_relative: e1,
latest_start_relative: e2,
earliest_end_relative: e3,
latest_end_relative: e4,
relative_offsets_extension: e5,
};
r.close();
Ok(v)
}
}
impl RelativeOffsets {
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.assigned_right_time_relative_extension { w.extension("afac:_assignedRightTimeRelativeExtension", v)?; }
if let Some(v) = &self.earliest_start_relative { w.pattern("earliestStartRelative", v, Pattern::Duration)?; w.leaf("afac:earliestStartRelative", v)?; }
if let Some(v) = &self.latest_start_relative { w.pattern("latestStartRelative", v, Pattern::Duration)?; w.leaf("afac:latestStartRelative", v)?; }
if let Some(v) = &self.earliest_end_relative { w.pattern("earliestEndRelative", v, Pattern::Duration)?; w.leaf("afac:earliestEndRelative", v)?; }
if let Some(v) = &self.latest_end_relative { w.pattern("latestEndRelative", v, Pattern::Duration)?; w.leaf("afac:latestEndRelative", v)?; }
if let Some(v) = &self.relative_offsets_extension { w.extension("afac:_relativeOffsetsExtension", v)?; }
w.end(tag)
}
}
impl RelativeOffsets {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
114 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
609 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1047 => if r.first(&mut seen[2])? { f2 = r.string()?; },
607 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1045 => if r.first(&mut seen[4])? { f4 = r.string()?; },
179 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
assigned_right_time_relative_extension: f0,
earliest_start_relative: f1,
latest_start_relative: f2,
earliest_end_relative: f3,
latest_end_relative: f4,
relative_offsets_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(122)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.assigned_right_time_relative_extension {
w.key(114)?;
w.extension(v)?;
}
if let Some(v) = &self.earliest_start_relative {
w.key(609)?;
w.pattern("earliestStartRelative", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.latest_start_relative {
w.key(1047)?;
w.pattern("latestStartRelative", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.earliest_end_relative {
w.key(607)?;
w.pattern("earliestEndRelative", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.latest_end_relative {
w.key(1045)?;
w.pattern("latestEndRelative", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.relative_offsets_extension {
w.key(179)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RelativeTimeRates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RelativeTimeRates {
/// XML attribute `collectionSequence`.
pub collection_sequence: Option<com::Integer>,
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Option<CurrencyCode>,
/// XML element `afac:minValueCollection`.
pub min_value_collection: Option<AmountOfMoney>,
/// XML element `afac:maxValueCollection`.
pub max_value_collection: Option<AmountOfMoney>,
/// XML element `afac:validStart`.
pub valid_start: Option<DateTime>,
/// XML element `afac:validEnd`.
pub valid_end: Option<DateTime>,
/// XML element `afac:minTime`.
pub min_time: Option<Duration>,
/// XML element `afac:maxTime`.
pub max_time: Option<Duration>,
/// XML element `afac:resetTime`.
pub reset_time: Option<Time>,
/// XML element `afac:taxIncluded`.
pub tax_included: Option<com::Boolean>,
/// XML element `afac:taxRate`.
pub tax_rate: Option<com::Percentage>,
/// XML element `afac:taxValue`.
pub tax_value: Option<AmountOfMoney>,
/// XML element `afac:relativeTimes`.
pub relative_times: Option<com::Boolean>,
/// XML element `afac:rateLine`.
pub rate_line: Vec<RateLine>,
/// XML element `afac:_rateLineCollectionExtension`.
pub rate_line_collection_extension: Option<Box<Extension>>,
/// XML element `afac:referenceTimeStart`.
pub reference_time_start: Option<DateTime>,
/// XML element `afac:referenceTimeEnd`.
pub reference_time_end: Option<DateTime>,
/// XML element `afac:_relativeTimeRatesExtension`.
pub relative_time_rates_extension: Option<Box<Extension>>,
}
impl RelativeTimeRates {
const FIELDS: &'static [u32] = &[0x206e8, 0x20976, 0x20943, 0x20c84, 0x20c82, 0x20974, 0x20941, 0x20b2f, 0x20c00, 0x20c01, 0x20c02, 0x20b1f, 0x20ae7, 0x205a8, 0x20b05, 0x20b04, 0x205bb];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201bf);
let a0 = r.req_attr_value::<i64>(1870)?;
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
let mut e12 = Vec::new();
let mut e13 = None;
let mut e14 = None;
let mut e15 = None;
let mut e16 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x206e8 => { let v = r.string()?; r.set(&mut e0, v, 1768); }
0x20976 => { let v = r.value::<Decimal>()?; r.set(&mut e1, v, 2422); }
0x20943 => { let v = r.value::<Decimal>()?; r.set(&mut e2, v, 2371); }
0x20c84 => { let v = r.date_time()?; r.set(&mut e3, v, 3204); }
0x20c82 => { let v = r.date_time()?; r.set(&mut e4, v, 3202); }
0x20974 => { let v = r.string()?; r.set(&mut e5, v, 2420); }
0x20941 => { let v = r.string()?; r.set(&mut e6, v, 2369); }
0x20b2f => { let v = r.value::<Time>()?; r.set(&mut e7, v, 2863); }
0x20c00 => { let v = r.value::<bool>()?; r.set(&mut e8, v, 3072); }
0x20c01 => { let v = r.value::<f32>()?; r.set(&mut e9, v, 3073); }
0x20c02 => { let v = r.value::<Decimal>()?; r.set(&mut e10, v, 3074); }
0x20b1f => { let v = r.value::<bool>()?; r.set(&mut e11, v, 2847); }
0x20ae7 => { let v = Some(RateLine::read(r)?); e12.extend(v); }
0x205a8 => { let v = r.raw()?; r.set(&mut e13, v.map(Box::new), 1448); }
0x20b05 => { let v = r.date_time()?; r.set(&mut e14, v, 2821); }
0x20b04 => { let v = r.date_time()?; r.set(&mut e15, v, 2820); }
0x205bb => { let v = r.raw()?; r.set(&mut e16, v.map(Box::new), 1467); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
collection_sequence: a0,
applicable_currency: e0,
min_value_collection: e1,
max_value_collection: e2,
valid_start: e3,
valid_end: e4,
min_time: e5,
max_time: e6,
reset_time: e7,
tax_included: e8,
tax_rate: e9,
tax_value: e10,
relative_times: e11,
rate_line: e12,
rate_line_collection_extension: e13,
reference_time_start: e14,
reference_time_end: e15,
relative_time_rates_extension: e16,
};
r.close();
Ok(v)
}
}
impl RelativeTimeRates {
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.collection_sequence {
Some(v) => { w.attr_value("collectionSequence", v)?; }
None => return Err(w.missing_attr("collectionSequence")),
}
if let Some(v) = &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.min_value_collection { w.digits("minValueCollection", v, 8, 2)?; w.leaf("afac:minValueCollection", v)?; }
if let Some(v) = &self.max_value_collection { w.digits("maxValueCollection", v, 8, 2)?; w.leaf("afac:maxValueCollection", v)?; }
if let Some(v) = &self.valid_start { w.leaf("afac:validStart", v)?; }
if let Some(v) = &self.valid_end { w.leaf("afac:validEnd", v)?; }
if let Some(v) = &self.min_time { w.pattern("minTime", v, Pattern::Duration)?; w.leaf("afac:minTime", v)?; }
if let Some(v) = &self.max_time { w.pattern("maxTime", v, Pattern::Duration)?; w.leaf("afac:maxTime", v)?; }
if let Some(v) = &self.reset_time { w.leaf("afac:resetTime", v)?; }
if let Some(v) = &self.tax_included { w.leaf("afac:taxIncluded", v)?; }
if let Some(v) = &self.tax_rate { w.leaf("afac:taxRate", v)?; }
if let Some(v) = &self.tax_value { w.digits("taxValue", v, 8, 2)?; w.leaf("afac:taxValue", v)?; }
if let Some(v) = &self.relative_times { w.leaf("afac:relativeTimes", v)?; }
w.count("afac:rateLine", self.rate_line.len(), 1, usize::MAX)?;
for v in &self.rate_line { v.write(w, "afac:rateLine", "", "")?; }
if let Some(v) = &self.rate_line_collection_extension { w.extension("afac:_rateLineCollectionExtension", v)?; }
if let Some(v) = &self.reference_time_start { w.leaf("afac:referenceTimeStart", v)?; }
if let Some(v) = &self.reference_time_end { w.leaf("afac:referenceTimeEnd", v)?; }
if let Some(v) = &self.relative_time_rates_extension { w.extension("afac:_relativeTimeRatesExtension", v)?; }
w.end(tag)
}
}
impl RelativeTimeRates {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 18];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = None;
let mut f13 = Vec::new();
let mut f14 = None;
let mut f15 = None;
let mut f16 = None;
let mut f17 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
348 => if r.first(&mut seen[0])? { f0 = r.number::<i64>()?; },
243 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1324 => if r.first(&mut seen[2])? { f2 = r.number::<Decimal>()?; },
1272 => if r.first(&mut seen[3])? { f3 = r.number::<Decimal>()?; },
2537 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
2535 => if r.first(&mut seen[5])? { f5 = r.date_time()?; },
1322 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1270 => if r.first(&mut seen[7])? { f7 = r.string()?; },
1886 => if r.first(&mut seen[8])? { f8 = r.text::<Time>()?; },
2235 => if r.first(&mut seen[9])? { f9 = r.boolean()?; },
2236 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
2237 => if r.first(&mut seen[11])? { f11 = r.number::<Decimal>()?; },
1847 => if r.first(&mut seen[12])? { f12 = r.boolean()?; },
1791 => if r.first(&mut seen[13])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateLine::read_json(r)? { f13.push(v); } } },
162 => if r.first(&mut seen[14])? { f14 = r.raw_object()?.map(Box::new); },
1821 => if r.first(&mut seen[15])? { f15 = r.date_time()?; },
1820 => if r.first(&mut seen[16])? { f16 = r.date_time()?; },
181 => if r.first(&mut seen[17])? { f17 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 348);
Ok(Self {
collection_sequence: f0,
applicable_currency: f1,
min_value_collection: f2,
max_value_collection: f3,
valid_start: f4,
valid_end: f5,
min_time: f6,
max_time: f7,
reset_time: f8,
tax_included: f9,
tax_rate: f10,
tax_value: f11,
relative_times: f12,
rate_line: f13,
rate_line_collection_extension: f14,
reference_time_start: f15,
reference_time_end: f16,
relative_time_rates_extension: f17,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(123)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.collection_sequence {
Some(v) => {
w.key(348)?;
w.integer(*v)?;
}
None => w.absent(348, w.missing_attr("collectionSequence"))?,
}
if let Some(v) = &self.applicable_currency {
w.key(243)?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
if let Some(v) = &self.min_value_collection {
w.key(1324)?;
w.digits("minValueCollection", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.max_value_collection {
w.key(1272)?;
w.digits("maxValueCollection", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.valid_start {
w.key(2537)?;
w.date_time(v)?;
}
if let Some(v) = &self.valid_end {
w.key(2535)?;
w.date_time(v)?;
}
if let Some(v) = &self.min_time {
w.key(1322)?;
w.pattern("minTime", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.max_time {
w.key(1270)?;
w.pattern("maxTime", v, Pattern::Duration)?; w.string(v)?;
}
if let Some(v) = &self.reset_time {
w.key(1886)?;
w.time(v)?;
}
if let Some(v) = &self.tax_included {
w.key(2235)?;
w.boolean(*v)?;
}
if let Some(v) = &self.tax_rate {
w.key(2236)?;
w.float32(*v)?;
}
if let Some(v) = &self.tax_value {
w.key(2237)?;
w.digits("taxValue", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.relative_times {
w.key(1847)?;
w.boolean(*v)?;
}
w.count("rateLine", self.rate_line.len(), 1, usize::MAX)?;
if !self.rate_line.is_empty() {
w.key(1791)?;
w.begin_array()?;
for v in &self.rate_line {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.rate_line_collection_extension {
w.key(162)?;
w.extension(v)?;
}
if let Some(v) = &self.reference_time_start {
w.key(1821)?;
w.date_time(v)?;
}
if let Some(v) = &self.reference_time_end {
w.key(1820)?;
w.date_time(v)?;
}
if let Some(v) = &self.relative_time_rates_extension {
w.key(181)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:RightSpecification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RightSpecification {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:type`.
pub r#type: Option<RightTypeEnum>,
/// XML element `afac:description`.
pub description: Vec<MultilingualString>,
/// XML element `afac:financialReference`.
pub financial_reference: Option<String>,
/// XML element `afac:issuer`.
pub issuer: Option<Box<com::VersionedReference>>,
/// XML element `afac:transferable`.
pub transferable: Option<com::Boolean>,
/// XML element `afac:transferableConditions`.
pub transferable_conditions: Option<MultilingualString>,
/// XML element `afac:credential`.
pub credential: Vec<AnyCredential>,
/// XML element `afac:validity`.
pub validity: Option<Box<com::Validity>>,
/// XML element `afac:_rightSpecificationExtension`.
pub right_specification_extension: Option<Box<Extension>>,
}
impl RightSpecification {
const FIELDS: &'static [u32] = &[0x20c5d, 0x207a8, 0x2085c, 0x208dc, 0x20c4c, 0x20c4d, 0x2077d, 0x20c86, 0x205c5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x201ca);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
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 = Vec::new();
let mut e7 = None;
let mut e8 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20c5d => { let v = r.enumeration::<RightTypeEnum>()?; r.set(&mut e0, v, 3165); }
0x207a8 => { let v = r.multilingual()?; e1.extend(v); }
0x2085c => { let v = r.string()?; r.set(&mut e2, v, 2140); }
0x208dc => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e3, v.map(Box::new), 2268); }
0x20c4c => { let v = r.value::<bool>()?; r.set(&mut e4, v, 3148); }
0x20c4d => { let v = r.multilingual()?; r.set(&mut e5, v, 3149); }
0x2077d => { let v = AnyCredential::read(r)?; e6.extend(v); }
0x20c86 => { let v = Some(com::Validity::read(r)?); r.set(&mut e7, v.map(Box::new), 3206); }
0x205c5 => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1477); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
version: a1,
r#type: e0,
description: e1,
financial_reference: e2,
issuer: e3,
transferable: e4,
transferable_conditions: e5,
credential: e6,
validity: e7,
right_specification_extension: e8,
};
r.close();
Ok(v)
}
}
impl RightSpecification {
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.r#type { w.enumeration("afac:type", v.literal())?; }
for v in &self.description { w.multilingual("afac:description", v)?; }
if let Some(v) = &self.financial_reference { w.max_len("financialReference", v, 1024)?; w.leaf("afac:financialReference", v)?; }
if let Some(v) = &self.issuer { v.write(w, "afac:issuer", "", " targetClass=\"afac:ReferenceableOrganisation\"")?; }
if let Some(v) = &self.transferable { w.leaf("afac:transferable", v)?; }
if let Some(v) = &self.transferable_conditions { w.multilingual("afac:transferableConditions", v)?; }
for v in &self.credential { v.write(w, "afac:credential")?; }
if let Some(v) = &self.validity { v.write(w, "afac:validity", "", "")?; }
if let Some(v) = &self.right_specification_extension { w.extension("afac:_rightSpecificationExtension", v)?; }
w.end(tag)
}
}
impl RightSpecification {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 11];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = Vec::new();
let mut f9 = None;
let mut f10 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
2495 => if r.first(&mut seen[2])? { f2 = r.enumeration::<RightTypeEnum>()?; },
545 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f3.push(v); } } },
850 => if r.first(&mut seen[4])? { f4 = r.string()?; },
1015 => if r.first(&mut seen[5])? { f5 = com::VersionedReference::read_json(r)?.map(Box::new); },
2373 => if r.first(&mut seen[6])? { f6 = r.boolean()?; },
2374 => if r.first(&mut seen[7])? { f7 = r.multilingual()?; },
475 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyCredential::read_json(r)? { f8.push(v); } } },
2539 => if r.first(&mut seen[9])? { f9 = com::Validity::read_json(r)?.map(Box::new); },
182 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
Ok(Self {
id: f0,
version: f1,
r#type: f2,
description: f3,
financial_reference: f4,
issuer: f5,
transferable: f6,
transferable_conditions: f7,
credential: f8,
validity: f9,
right_specification_extension: f10,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(125)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.r#type {
w.key(2495)?;
w.enumeration(126, v.literal())?;
}
if !self.description.is_empty() {
w.key(545)?;
w.begin_array()?;
for v in &self.description {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.financial_reference {
w.key(850)?;
w.max_len("financialReference", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.issuer {
w.key(1015)?;
v.write_json(w, Some("ReferenceableOrganisation"))?;
}
if let Some(v) = &self.transferable {
w.key(2373)?;
w.boolean(*v)?;
}
if let Some(v) = &self.transferable_conditions {
w.key(2374)?;
w.multilingual(v)?;
}
if !self.credential.is_empty() {
w.key(475)?;
w.begin_array()?;
for v in &self.credential {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.validity {
w.key(2539)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.right_specification_extension {
w.key(182)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:SupplementalEquipment`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SupplementalEquipment {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:alias`.
pub alias: Vec<MultilingualString>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:accessibility`.
pub accessibility: Vec<AccessibilityEnum>,
/// XML element `afac:additionalInformation`.
pub additional_information: Vec<MultilingualString>,
/// XML element `afac:externalIdentifier`.
pub external_identifier: Vec<ExternalIdentifier>,
/// XML element `afac:informationWebsite`.
pub information_website: Vec<com::UrlLink>,
/// XML element `afac:photoUrl`.
pub photo_url: Vec<com::UrlLink>,
/// XML element `afac:photo`.
pub photo: Vec<Image>,
/// XML element `afac:operatingHours`.
pub operating_hours: Option<OperatingHours>,
/// XML element `afac:locationReference`.
pub location_reference: Option<loc::LocationReference>,
/// XML element `afac:owner`.
pub owner: Option<Organisation>,
/// XML element `afac:operator`.
pub operator: Option<Organisation>,
/// XML element `afac:helpdesk`.
pub helpdesk: Option<Organisation>,
/// XML element `afac:associatedFacility`.
pub associated_facility: Vec<AnyAssociatedFacility>,
/// XML element `afac:rates`.
pub rates: Option<Rates>,
/// XML element `afac:applicableForVehicles`.
pub applicable_for_vehicles: Vec<com::VehicleCharacteristics>,
/// XML element `afac:dimension`.
pub dimension: Option<Box<Dimension>>,
/// XML element `afac:amenities`.
pub amenities: Option<Box<Amenities>>,
/// XML element `afac:_facilityObjectExtension`.
pub facility_object_extension: Option<Box<Extension>>,
/// XML element `afac:availability`.
pub availability: Option<AvailabilityEnum>,
/// XML element `afac:quantity`.
pub quantity: Option<com::NonNegativeInteger>,
/// XML element `afac:regularlyCleaned`.
pub regularly_cleaned: Option<com::Boolean>,
/// XML element `afac:applicableForUser`.
pub applicable_for_user: Vec<UserTypeEnum>,
/// XML element `afac:nearby`.
pub nearby: Option<com::Boolean>,
/// XML element `afac:_supplementalFacilityExtension`.
pub supplemental_facility_extension: Option<Box<Extension>>,
/// XML element `afac:equipmentType`.
pub equipment_type: Option<EquipmentTypeEnum>,
/// XML element `afac:_supplementalEquipmentExtension`.
pub supplemental_equipment_extension: Option<Box<Extension>>,
}
impl SupplementalEquipment {
const FIELDS: &'static [u32] = &[0x2098b, 0x206d6, 0x208f8, 0x207a8, 0x20694, 0x206b9, 0x20840, 0x208c5, 0x20a73, 0x20a72, 0x20a09, 0x20926, 0x20a3d, 0x20a17, 0x208a0, 0x206fc, 0x20af7, 0x206ef, 0x207b7, 0x206e1, 0x204b7, 0x20705, 0x20adf, 0x20b15, 0x206ee, 0x20996, 0x20605, 0x2081f, 0x20604];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2020b);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = Vec::new();
let mut e6 = Vec::new();
let mut e7 = Vec::new();
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
let mut e15 = Vec::new();
let mut e16 = None;
let mut e17 = Vec::new();
let mut e18 = None;
let mut e19 = None;
let mut e20 = None;
let mut e21 = None;
let mut e22 = None;
let mut e23 = None;
let mut e24 = Vec::new();
let mut e25 = None;
let mut e26 = None;
let mut e27 = None;
let mut e28 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0x206d6 => { let v = r.multilingual()?; e1.extend(v); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e3, v, 1960); }
0x20694 => { let v = r.enumeration::<AccessibilityEnum>()?; e4.extend(v); }
0x206b9 => { let v = r.multilingual()?; e5.extend(v); }
0x20840 => { let v = Some(ExternalIdentifier::read(r)?); e6.extend(v); }
0x208c5 => { let v = Some(com::UrlLink::read(r)?); e7.extend(v); }
0x20a73 => { let v = Some(com::UrlLink::read(r)?); e8.extend(v); }
0x20a72 => { let v = Some(Image::read(r)?); e9.extend(v); }
0x20a09 => { let v = OperatingHours::read(r)?; r.set(&mut e10, v, 2569); }
0x20926 => { let v = loc::LocationReference::read(r)?; r.set(&mut e11, v, 2342); }
0x20a3d => { let v = Organisation::read(r)?; r.set(&mut e12, v, 2621); }
0x20a17 => { let v = Organisation::read(r)?; r.set(&mut e13, v, 2583); }
0x208a0 => { let v = Organisation::read(r)?; r.set(&mut e14, v, 2208); }
0x206fc => { let v = AnyAssociatedFacility::read(r)?; e15.extend(v); }
0x20af7 => { let v = Rates::read(r)?; r.set(&mut e16, v, 2807); }
0x206ef => { let v = Some(com::VehicleCharacteristics::read(r)?); e17.extend(v); }
0x207b7 => { let v = Some(Dimension::read(r)?); r.set(&mut e18, v.map(Box::new), 1975); }
0x206e1 => { let v = Some(Amenities::read(r)?); r.set(&mut e19, v.map(Box::new), 1761); }
0x204b7 => { let v = r.raw()?; r.set(&mut e20, v.map(Box::new), 1207); }
0x20705 => { let v = r.enumeration::<AvailabilityEnum>()?; r.set(&mut e21, v, 1797); }
0x20adf => { let v = r.value::<u64>()?; r.set(&mut e22, v, 2783); }
0x20b15 => { let v = r.value::<bool>()?; r.set(&mut e23, v, 2837); }
0x206ee => { let v = r.enumeration::<UserTypeEnum>()?; e24.extend(v); }
0x20996 => { let v = r.value::<bool>()?; r.set(&mut e25, v, 2454); }
0x20605 => { let v = r.raw()?; r.set(&mut e26, v.map(Box::new), 1541); }
0x2081f => { let v = r.enumeration::<EquipmentTypeEnum>()?; r.set(&mut e27, v, 2079); }
0x20604 => { let v = r.raw()?; r.set(&mut e28, v.map(Box::new), 1540); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e27, 2079);
let v = Self {
id: a0,
version: a1,
name: e0,
alias: e1,
last_updated: e2,
description: e3,
accessibility: e4,
additional_information: e5,
external_identifier: e6,
information_website: e7,
photo_url: e8,
photo: e9,
operating_hours: e10,
location_reference: e11,
owner: e12,
operator: e13,
helpdesk: e14,
associated_facility: e15,
rates: e16,
applicable_for_vehicles: e17,
dimension: e18,
amenities: e19,
facility_object_extension: e20,
availability: e21,
quantity: e22,
regularly_cleaned: e23,
applicable_for_user: e24,
nearby: e25,
supplemental_facility_extension: e26,
equipment_type: e27,
supplemental_equipment_extension: e28,
};
r.close();
Ok(v)
}
}
impl SupplementalEquipment {
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("afac:name", v)?; }
for v in &self.alias { w.multilingual("afac:alias", v)?; }
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
for v in &self.accessibility { w.enumeration("afac:accessibility", v.literal())?; }
for v in &self.additional_information { w.multilingual("afac:additionalInformation", v)?; }
for v in &self.external_identifier { v.write(w, "afac:externalIdentifier", "", "")?; }
for v in &self.information_website { v.write(w, "afac:informationWebsite", "", "")?; }
for v in &self.photo_url { v.write(w, "afac:photoUrl", "", "")?; }
for v in &self.photo { v.write(w, "afac:photo", "", "")?; }
if let Some(v) = &self.operating_hours { v.write(w, "afac:operatingHours")?; }
if let Some(v) = &self.location_reference { v.write(w, "afac:locationReference")?; }
if let Some(v) = &self.owner { v.write(w, "afac:owner")?; }
if let Some(v) = &self.operator { v.write(w, "afac:operator")?; }
if let Some(v) = &self.helpdesk { v.write(w, "afac:helpdesk")?; }
for v in &self.associated_facility { v.write(w, "afac:associatedFacility")?; }
if let Some(v) = &self.rates { v.write(w, "afac:rates")?; }
for v in &self.applicable_for_vehicles { v.write(w, "afac:applicableForVehicles", "", "")?; }
if let Some(v) = &self.dimension { v.write(w, "afac:dimension", "", "")?; }
if let Some(v) = &self.amenities { v.write(w, "afac:amenities", "", "")?; }
if let Some(v) = &self.facility_object_extension { w.extension("afac:_facilityObjectExtension", v)?; }
if let Some(v) = &self.availability { w.enumeration("afac:availability", v.literal())?; }
if let Some(v) = &self.quantity { w.leaf("afac:quantity", v)?; }
if let Some(v) = &self.regularly_cleaned { w.leaf("afac:regularlyCleaned", v)?; }
for v in &self.applicable_for_user { w.enumeration("afac:applicableForUser", v.literal())?; }
if let Some(v) = &self.nearby { w.leaf("afac:nearby", v)?; }
if let Some(v) = &self.supplemental_facility_extension { w.extension("afac:_supplementalFacilityExtension", v)?; }
match &self.equipment_type {
Some(v) => { w.enumeration("afac:equipmentType", v.literal())?; }
None => return Err(w.missing("afac:equipmentType")),
}
if let Some(v) = &self.supplemental_equipment_extension { w.extension("afac:_supplementalEquipmentExtension", v)?; }
w.end(tag)
}
}
impl SupplementalEquipment {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 31];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
let mut f5 = None;
let mut f6 = Vec::new();
let mut f7 = Vec::new();
let mut f8 = Vec::new();
let mut f9 = Vec::new();
let mut f10 = Vec::new();
let mut f11 = Vec::new();
let mut f12 = None;
let mut f13 = None;
let mut f14 = None;
let mut f15 = None;
let mut f16 = None;
let mut f17 = Vec::new();
let mut f18 = None;
let mut f19 = Vec::new();
let mut f20 = None;
let mut f21 = None;
let mut f22 = None;
let mut f23 = None;
let mut f24 = None;
let mut f25 = None;
let mut f26 = Vec::new();
let mut f27 = None;
let mut f28 = None;
let mut f29 = None;
let mut f30 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1345 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
225 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f3.push(v); } } },
1043 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
545 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
25 => if r.first(&mut seen[6])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<AccessibilityEnum>()? { f6.push(v); } } },
61 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f7.push(v); } } },
739 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalIdentifier::read_json(r)? { f8.push(v); } } },
992 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::UrlLink::read_json(r)? { f9.push(v); } } },
1573 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::UrlLink::read_json(r)? { f10.push(v); } } },
1572 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Image::read_json(r)? { f11.push(v); } } },
1469 => if r.first(&mut seen[12])? { f12 = OperatingHours::read_json(r)?; },
1240 => if r.first(&mut seen[13])? { f13 = loc::LocationReference::read_json(r)?; },
1520 => if r.first(&mut seen[14])? { f14 = Organisation::read_json(r)?; },
1483 => if r.first(&mut seen[15])? { f15 = Organisation::read_json(r)?; },
953 => if r.first(&mut seen[16])? { f16 = Organisation::read_json(r)?; },
263 => if r.first(&mut seen[17])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyAssociatedFacility::read_json(r)? { f17.push(v); } } },
1807 => if r.first(&mut seen[18])? { f18 = Rates::read_json(r)?; },
250 => if r.first(&mut seen[19])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::VehicleCharacteristics::read_json(r)? { f19.push(v); } } },
560 => if r.first(&mut seen[20])? { f20 = Dimension::read_json(r)?.map(Box::new); },
236 => if r.first(&mut seen[21])? { f21 = Amenities::read_json(r)?.map(Box::new); },
131 => if r.first(&mut seen[22])? { f22 = r.raw_object()?.map(Box::new); },
272 => if r.first(&mut seen[23])? { f23 = r.enumeration::<AvailabilityEnum>()?; },
1783 => if r.first(&mut seen[24])? { f24 = r.number::<u64>()?; },
1837 => if r.first(&mut seen[25])? { f25 = r.boolean()?; },
249 => if r.first(&mut seen[26])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<UserTypeEnum>()? { f26.push(v); } } },
1355 => if r.first(&mut seen[27])? { f27 = r.boolean()?; },
185 => if r.first(&mut seen[28])? { f28 = r.raw_object()?.map(Box::new); },
698 => if r.first(&mut seen[29])? { f29 = r.enumeration::<EquipmentTypeEnum>()?; },
184 => if r.first(&mut seen[30])? { f30 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f29, 698);
Ok(Self {
id: f0,
version: f1,
name: f2,
alias: f3,
last_updated: f4,
description: f5,
accessibility: f6,
additional_information: f7,
external_identifier: f8,
information_website: f9,
photo_url: f10,
photo: f11,
operating_hours: f12,
location_reference: f13,
owner: f14,
operator: f15,
helpdesk: f16,
associated_facility: f17,
rates: f18,
applicable_for_vehicles: f19,
dimension: f20,
amenities: f21,
facility_object_extension: f22,
availability: f23,
quantity: f24,
regularly_cleaned: f25,
applicable_for_user: f26,
nearby: f27,
supplemental_facility_extension: f28,
equipment_type: f29,
supplemental_equipment_extension: f30,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(128)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
if !self.alias.is_empty() {
w.key(225)?;
w.begin_array()?;
for v in &self.alias {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if !self.accessibility.is_empty() {
w.key(25)?;
w.begin_array()?;
for v in &self.accessibility {
w.item()?;
w.enumeration(53, v.literal())?;
}
w.end_array()?;
}
if !self.additional_information.is_empty() {
w.key(61)?;
w.begin_array()?;
for v in &self.additional_information {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if !self.external_identifier.is_empty() {
w.key(739)?;
w.begin_array()?;
for v in &self.external_identifier {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.information_website.is_empty() {
w.key(992)?;
w.begin_array()?;
for v in &self.information_website {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.photo_url.is_empty() {
w.key(1573)?;
w.begin_array()?;
for v in &self.photo_url {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.photo.is_empty() {
w.key(1572)?;
w.begin_array()?;
for v in &self.photo {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.operating_hours {
w.key(1469)?;
v.write_json(w)?;
}
if let Some(v) = &self.location_reference {
w.key(1240)?;
v.write_json(w)?;
}
if let Some(v) = &self.owner {
w.key(1520)?;
v.write_json(w)?;
}
if let Some(v) = &self.operator {
w.key(1483)?;
v.write_json(w)?;
}
if let Some(v) = &self.helpdesk {
w.key(953)?;
v.write_json(w)?;
}
if !self.associated_facility.is_empty() {
w.key(263)?;
w.begin_array()?;
for v in &self.associated_facility {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.rates {
w.key(1807)?;
v.write_json(w)?;
}
if !self.applicable_for_vehicles.is_empty() {
w.key(250)?;
w.begin_array()?;
for v in &self.applicable_for_vehicles {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.dimension {
w.key(560)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.amenities {
w.key(236)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.facility_object_extension {
w.key(131)?;
w.extension(v)?;
}
if let Some(v) = &self.availability {
w.key(272)?;
w.enumeration(62, v.literal())?;
}
if let Some(v) = &self.quantity {
w.key(1783)?;
w.integer(*v)?;
}
if let Some(v) = &self.regularly_cleaned {
w.key(1837)?;
w.boolean(*v)?;
}
if !self.applicable_for_user.is_empty() {
w.key(249)?;
w.begin_array()?;
for v in &self.applicable_for_user {
w.item()?;
w.enumeration(144, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.nearby {
w.key(1355)?;
w.boolean(*v)?;
}
if let Some(v) = &self.supplemental_facility_extension {
w.key(185)?;
w.extension(v)?;
}
match &self.equipment_type {
Some(v) => {
w.key(698)?;
w.enumeration(75, v.literal())?;
}
None => w.absent(698, w.missing("equipmentType"))?,
}
if let Some(v) = &self.supplemental_equipment_extension {
w.key(184)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:SupplementalFacilityStatus`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SupplementalFacilityStatus {
/// XML element `afac:reference`.
pub reference: Option<Box<com::VersionedReference>>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:openingStatus`.
pub opening_status: Option<OpeningStatusEnum>,
/// XML element `afac:operationStatus`.
pub operation_status: Option<OperationStatusEnum>,
/// XML element `afac:regularOperatingHoursInForce`.
pub regular_operating_hours_in_force: Option<com::Boolean>,
/// XML element `afac:statusDescription`.
pub status_description: Option<MultilingualString>,
/// XML element `afac:newOperatingHours`.
pub new_operating_hours: Option<OperatingHours>,
/// XML element `afac:newRates`.
pub new_rates: Option<Rates>,
/// XML element `afac:fault`.
pub fault: Option<com::AnyFault>,
/// XML element `afac:_facilityObjectStatusExtension`.
pub facility_object_status_extension: Option<Box<Extension>>,
/// XML element `afac:quantityOverride`.
pub quantity_override: Option<com::NonNegativeInteger>,
/// XML element `afac:numberOfSubitemsOverride`.
pub number_of_subitems_override: Option<com::NonNegativeInteger>,
/// XML element `afac:vacantSubitems`.
pub vacant_subitems: Option<com::NonNegativeInteger>,
/// XML element `afac:equipmentOperationStatus`.
pub equipment_operation_status: Option<OperationStatusEnum>,
/// XML element `afac:_supplementalFacilityStatusExtension`.
pub supplemental_facility_status_extension: Option<Box<Extension>>,
}
impl SupplementalFacilityStatus {
const FIELDS: &'static [u32] = &[0x20b01, 0x208f8, 0x209ec, 0x20a13, 0x20b13, 0x20bd2, 0x2099a, 0x2099b, 0x20849, 0x204b8, 0x20ae0, 0x209c9, 0x20c81, 0x2081d, 0x20606];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2020d);
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20b01 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2817); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e1, v, 2296); }
0x209ec => { let v = r.enumeration::<OpeningStatusEnum>()?; r.set(&mut e2, v, 2540); }
0x20a13 => { let v = r.enumeration::<OperationStatusEnum>()?; r.set(&mut e3, v, 2579); }
0x20b13 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2835); }
0x20bd2 => { let v = r.multilingual()?; r.set(&mut e5, v, 3026); }
0x2099a => { let v = OperatingHours::read(r)?; r.set(&mut e6, v, 2458); }
0x2099b => { let v = Rates::read(r)?; r.set(&mut e7, v, 2459); }
0x20849 => { let v = com::AnyFault::read(r)?; r.set(&mut e8, v, 2121); }
0x204b8 => { let v = r.raw()?; r.set(&mut e9, v.map(Box::new), 1208); }
0x20ae0 => { let v = r.value::<u64>()?; r.set(&mut e10, v, 2784); }
0x209c9 => { let v = r.value::<u64>()?; r.set(&mut e11, v, 2505); }
0x20c81 => { let v = r.value::<u64>()?; r.set(&mut e12, v, 3201); }
0x2081d => { let v = r.enumeration::<OperationStatusEnum>()?; r.set(&mut e13, v, 2077); }
0x20606 => { let v = r.raw()?; r.set(&mut e14, v.map(Box::new), 1542); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2817);
let v = Self {
reference: e0,
last_updated: e1,
opening_status: e2,
operation_status: e3,
regular_operating_hours_in_force: e4,
status_description: e5,
new_operating_hours: e6,
new_rates: e7,
fault: e8,
facility_object_status_extension: e9,
quantity_override: e10,
number_of_subitems_override: e11,
vacant_subitems: e12,
equipment_operation_status: e13,
supplemental_facility_status_extension: e14,
};
r.close();
Ok(v)
}
}
impl SupplementalFacilityStatus {
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.reference {
Some(v) => { v.write(w, "afac:reference", "", " targetClass=\"afac:FacilityObject\"")?; }
None => return Err(w.missing("afac:reference")),
}
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.opening_status { w.enumeration("afac:openingStatus", v.literal())?; }
if let Some(v) = &self.operation_status { w.enumeration("afac:operationStatus", v.literal())?; }
if let Some(v) = &self.regular_operating_hours_in_force { w.leaf("afac:regularOperatingHoursInForce", v)?; }
if let Some(v) = &self.status_description { w.multilingual("afac:statusDescription", v)?; }
if let Some(v) = &self.new_operating_hours { v.write(w, "afac:newOperatingHours")?; }
if let Some(v) = &self.new_rates { v.write(w, "afac:newRates")?; }
if let Some(v) = &self.fault { v.write(w, "afac:fault")?; }
if let Some(v) = &self.facility_object_status_extension { w.extension("afac:_facilityObjectStatusExtension", v)?; }
if let Some(v) = &self.quantity_override { w.leaf("afac:quantityOverride", v)?; }
if let Some(v) = &self.number_of_subitems_override { w.leaf("afac:numberOfSubitemsOverride", v)?; }
if let Some(v) = &self.vacant_subitems { w.leaf("afac:vacantSubitems", v)?; }
if let Some(v) = &self.equipment_operation_status { w.enumeration("afac:equipmentOperationStatus", v.literal())?; }
if let Some(v) = &self.supplemental_facility_status_extension { w.extension("afac:_supplementalFacilityStatusExtension", v)?; }
w.end(tag)
}
}
impl SupplementalFacilityStatus {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 15];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = None;
let mut f13 = None;
let mut f14 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1817 => if r.first(&mut seen[0])? { f0 = com::VersionedReference::read_json(r)?.map(Box::new); },
1043 => if r.first(&mut seen[1])? { f1 = r.date_time()?; },
1440 => if r.first(&mut seen[2])? { f2 = r.enumeration::<OpeningStatusEnum>()?; },
1479 => if r.first(&mut seen[3])? { f3 = r.enumeration::<OperationStatusEnum>()?; },
1835 => if r.first(&mut seen[4])? { f4 = r.boolean()?; },
2191 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
1358 => if r.first(&mut seen[6])? { f6 = OperatingHours::read_json(r)?; },
1359 => if r.first(&mut seen[7])? { f7 = Rates::read_json(r)?; },
831 => if r.first(&mut seen[8])? { f8 = com::AnyFault::read_json(r)?; },
132 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
1784 => if r.first(&mut seen[10])? { f10 = r.number::<u64>()?; },
1405 => if r.first(&mut seen[11])? { f11 = r.number::<u64>()?; },
2534 => if r.first(&mut seen[12])? { f12 = r.number::<u64>()?; },
696 => if r.first(&mut seen[13])? { f13 = r.enumeration::<OperationStatusEnum>()?; },
186 => if r.first(&mut seen[14])? { f14 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1817);
Ok(Self {
reference: f0,
last_updated: f1,
opening_status: f2,
operation_status: f3,
regular_operating_hours_in_force: f4,
status_description: f5,
new_operating_hours: f6,
new_rates: f7,
fault: f8,
facility_object_status_extension: f9,
quantity_override: f10,
number_of_subitems_override: f11,
vacant_subitems: f12,
equipment_operation_status: f13,
supplemental_facility_status_extension: f14,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(130)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.reference {
Some(v) => {
w.key(1817)?;
v.write_json(w, Some("FacilityObject"))?;
}
None => w.absent(1817, w.missing("reference"))?,
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.opening_status {
w.key(1440)?;
w.enumeration(88, v.literal())?;
}
if let Some(v) = &self.operation_status {
w.key(1479)?;
w.enumeration(94, v.literal())?;
}
if let Some(v) = &self.regular_operating_hours_in_force {
w.key(1835)?;
w.boolean(*v)?;
}
if let Some(v) = &self.status_description {
w.key(2191)?;
w.multilingual(v)?;
}
if let Some(v) = &self.new_operating_hours {
w.key(1358)?;
v.write_json(w)?;
}
if let Some(v) = &self.new_rates {
w.key(1359)?;
v.write_json(w)?;
}
if let Some(v) = &self.fault {
w.key(831)?;
v.write_json(w)?;
}
if let Some(v) = &self.facility_object_status_extension {
w.key(132)?;
w.extension(v)?;
}
if let Some(v) = &self.quantity_override {
w.key(1784)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_subitems_override {
w.key(1405)?;
w.integer(*v)?;
}
if let Some(v) = &self.vacant_subitems {
w.key(2534)?;
w.integer(*v)?;
}
if let Some(v) = &self.equipment_operation_status {
w.key(696)?;
w.enumeration(94, v.literal())?;
}
if let Some(v) = &self.supplemental_facility_status_extension {
w.key(186)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:SupplementalServiceFacility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SupplementalServiceFacility {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `afac:name`.
pub name: Option<MultilingualString>,
/// XML element `afac:alias`.
pub alias: Vec<MultilingualString>,
/// XML element `afac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `afac:description`.
pub description: Option<MultilingualString>,
/// XML element `afac:accessibility`.
pub accessibility: Vec<AccessibilityEnum>,
/// XML element `afac:additionalInformation`.
pub additional_information: Vec<MultilingualString>,
/// XML element `afac:externalIdentifier`.
pub external_identifier: Vec<ExternalIdentifier>,
/// XML element `afac:informationWebsite`.
pub information_website: Vec<com::UrlLink>,
/// XML element `afac:photoUrl`.
pub photo_url: Vec<com::UrlLink>,
/// XML element `afac:photo`.
pub photo: Vec<Image>,
/// XML element `afac:operatingHours`.
pub operating_hours: Option<OperatingHours>,
/// XML element `afac:locationReference`.
pub location_reference: Option<loc::LocationReference>,
/// XML element `afac:owner`.
pub owner: Option<Organisation>,
/// XML element `afac:operator`.
pub operator: Option<Organisation>,
/// XML element `afac:helpdesk`.
pub helpdesk: Option<Organisation>,
/// XML element `afac:associatedFacility`.
pub associated_facility: Vec<AnyAssociatedFacility>,
/// XML element `afac:rates`.
pub rates: Option<Rates>,
/// XML element `afac:applicableForVehicles`.
pub applicable_for_vehicles: Vec<com::VehicleCharacteristics>,
/// XML element `afac:dimension`.
pub dimension: Option<Box<Dimension>>,
/// XML element `afac:amenities`.
pub amenities: Option<Box<Amenities>>,
/// XML element `afac:_facilityObjectExtension`.
pub facility_object_extension: Option<Box<Extension>>,
/// XML element `afac:availability`.
pub availability: Option<AvailabilityEnum>,
/// XML element `afac:quantity`.
pub quantity: Option<com::NonNegativeInteger>,
/// XML element `afac:regularlyCleaned`.
pub regularly_cleaned: Option<com::Boolean>,
/// XML element `afac:applicableForUser`.
pub applicable_for_user: Vec<UserTypeEnum>,
/// XML element `afac:nearby`.
pub nearby: Option<com::Boolean>,
/// XML element `afac:_supplementalFacilityExtension`.
pub supplemental_facility_extension: Option<Box<Extension>>,
/// XML element `afac:serviceFacilityType`.
pub service_facility_type: Option<ServiceFacilityTypeEnum>,
/// XML element `afac:numberOfSubitems`.
pub number_of_subitems: Option<com::NonNegativeInteger>,
/// XML element `afac:distanceFromOriginFacility`.
pub distance_from_origin_facility: Option<com::MetresAsNonNegativeInteger>,
/// XML element `afac:_supplementalServiceFacilityExtension`.
pub supplemental_service_facility_extension: Option<Box<Extension>>,
}
impl SupplementalServiceFacility {
const FIELDS: &'static [u32] = &[0x2098b, 0x206d6, 0x208f8, 0x207a8, 0x20694, 0x206b9, 0x20840, 0x208c5, 0x20a73, 0x20a72, 0x20a09, 0x20926, 0x20a3d, 0x20a17, 0x208a0, 0x206fc, 0x20af7, 0x206ef, 0x207b7, 0x206e1, 0x204b7, 0x20705, 0x20adf, 0x20b15, 0x206ee, 0x20996, 0x20605, 0x20b80, 0x209c8, 0x207d2, 0x20607];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2020e);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = Vec::new();
let mut e6 = Vec::new();
let mut e7 = Vec::new();
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
let mut e15 = Vec::new();
let mut e16 = None;
let mut e17 = Vec::new();
let mut e18 = None;
let mut e19 = None;
let mut e20 = None;
let mut e21 = None;
let mut e22 = None;
let mut e23 = None;
let mut e24 = Vec::new();
let mut e25 = None;
let mut e26 = None;
let mut e27 = None;
let mut e28 = None;
let mut e29 = None;
let mut e30 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x2098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0x206d6 => { let v = r.multilingual()?; e1.extend(v); }
0x208f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0x207a8 => { let v = r.multilingual()?; r.set(&mut e3, v, 1960); }
0x20694 => { let v = r.enumeration::<AccessibilityEnum>()?; e4.extend(v); }
0x206b9 => { let v = r.multilingual()?; e5.extend(v); }
0x20840 => { let v = Some(ExternalIdentifier::read(r)?); e6.extend(v); }
0x208c5 => { let v = Some(com::UrlLink::read(r)?); e7.extend(v); }
0x20a73 => { let v = Some(com::UrlLink::read(r)?); e8.extend(v); }
0x20a72 => { let v = Some(Image::read(r)?); e9.extend(v); }
0x20a09 => { let v = OperatingHours::read(r)?; r.set(&mut e10, v, 2569); }
0x20926 => { let v = loc::LocationReference::read(r)?; r.set(&mut e11, v, 2342); }
0x20a3d => { let v = Organisation::read(r)?; r.set(&mut e12, v, 2621); }
0x20a17 => { let v = Organisation::read(r)?; r.set(&mut e13, v, 2583); }
0x208a0 => { let v = Organisation::read(r)?; r.set(&mut e14, v, 2208); }
0x206fc => { let v = AnyAssociatedFacility::read(r)?; e15.extend(v); }
0x20af7 => { let v = Rates::read(r)?; r.set(&mut e16, v, 2807); }
0x206ef => { let v = Some(com::VehicleCharacteristics::read(r)?); e17.extend(v); }
0x207b7 => { let v = Some(Dimension::read(r)?); r.set(&mut e18, v.map(Box::new), 1975); }
0x206e1 => { let v = Some(Amenities::read(r)?); r.set(&mut e19, v.map(Box::new), 1761); }
0x204b7 => { let v = r.raw()?; r.set(&mut e20, v.map(Box::new), 1207); }
0x20705 => { let v = r.enumeration::<AvailabilityEnum>()?; r.set(&mut e21, v, 1797); }
0x20adf => { let v = r.value::<u64>()?; r.set(&mut e22, v, 2783); }
0x20b15 => { let v = r.value::<bool>()?; r.set(&mut e23, v, 2837); }
0x206ee => { let v = r.enumeration::<UserTypeEnum>()?; e24.extend(v); }
0x20996 => { let v = r.value::<bool>()?; r.set(&mut e25, v, 2454); }
0x20605 => { let v = r.raw()?; r.set(&mut e26, v.map(Box::new), 1541); }
0x20b80 => { let v = r.enumeration::<ServiceFacilityTypeEnum>()?; r.set(&mut e27, v, 2944); }
0x209c8 => { let v = r.value::<u64>()?; r.set(&mut e28, v, 2504); }
0x207d2 => { let v = r.value::<u64>()?; r.set(&mut e29, v, 2002); }
0x20607 => { let v = r.raw()?; r.set(&mut e30, v.map(Box::new), 1543); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e27, 2944);
let v = Self {
id: a0,
version: a1,
name: e0,
alias: e1,
last_updated: e2,
description: e3,
accessibility: e4,
additional_information: e5,
external_identifier: e6,
information_website: e7,
photo_url: e8,
photo: e9,
operating_hours: e10,
location_reference: e11,
owner: e12,
operator: e13,
helpdesk: e14,
associated_facility: e15,
rates: e16,
applicable_for_vehicles: e17,
dimension: e18,
amenities: e19,
facility_object_extension: e20,
availability: e21,
quantity: e22,
regularly_cleaned: e23,
applicable_for_user: e24,
nearby: e25,
supplemental_facility_extension: e26,
service_facility_type: e27,
number_of_subitems: e28,
distance_from_origin_facility: e29,
supplemental_service_facility_extension: e30,
};
r.close();
Ok(v)
}
}
impl SupplementalServiceFacility {
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("afac:name", v)?; }
for v in &self.alias { w.multilingual("afac:alias", v)?; }
if let Some(v) = &self.last_updated { w.leaf("afac:lastUpdated", v)?; }
if let Some(v) = &self.description { w.multilingual("afac:description", v)?; }
for v in &self.accessibility { w.enumeration("afac:accessibility", v.literal())?; }
for v in &self.additional_information { w.multilingual("afac:additionalInformation", v)?; }
for v in &self.external_identifier { v.write(w, "afac:externalIdentifier", "", "")?; }
for v in &self.information_website { v.write(w, "afac:informationWebsite", "", "")?; }
for v in &self.photo_url { v.write(w, "afac:photoUrl", "", "")?; }
for v in &self.photo { v.write(w, "afac:photo", "", "")?; }
if let Some(v) = &self.operating_hours { v.write(w, "afac:operatingHours")?; }
if let Some(v) = &self.location_reference { v.write(w, "afac:locationReference")?; }
if let Some(v) = &self.owner { v.write(w, "afac:owner")?; }
if let Some(v) = &self.operator { v.write(w, "afac:operator")?; }
if let Some(v) = &self.helpdesk { v.write(w, "afac:helpdesk")?; }
for v in &self.associated_facility { v.write(w, "afac:associatedFacility")?; }
if let Some(v) = &self.rates { v.write(w, "afac:rates")?; }
for v in &self.applicable_for_vehicles { v.write(w, "afac:applicableForVehicles", "", "")?; }
if let Some(v) = &self.dimension { v.write(w, "afac:dimension", "", "")?; }
if let Some(v) = &self.amenities { v.write(w, "afac:amenities", "", "")?; }
if let Some(v) = &self.facility_object_extension { w.extension("afac:_facilityObjectExtension", v)?; }
if let Some(v) = &self.availability { w.enumeration("afac:availability", v.literal())?; }
if let Some(v) = &self.quantity { w.leaf("afac:quantity", v)?; }
if let Some(v) = &self.regularly_cleaned { w.leaf("afac:regularlyCleaned", v)?; }
for v in &self.applicable_for_user { w.enumeration("afac:applicableForUser", v.literal())?; }
if let Some(v) = &self.nearby { w.leaf("afac:nearby", v)?; }
if let Some(v) = &self.supplemental_facility_extension { w.extension("afac:_supplementalFacilityExtension", v)?; }
match &self.service_facility_type {
Some(v) => { w.enumeration("afac:serviceFacilityType", v.literal())?; }
None => return Err(w.missing("afac:serviceFacilityType")),
}
if let Some(v) = &self.number_of_subitems { w.leaf("afac:numberOfSubitems", v)?; }
if let Some(v) = &self.distance_from_origin_facility { w.leaf("afac:distanceFromOriginFacility", v)?; }
if let Some(v) = &self.supplemental_service_facility_extension { w.extension("afac:_supplementalServiceFacilityExtension", v)?; }
w.end(tag)
}
}
impl SupplementalServiceFacility {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 33];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
let mut f5 = None;
let mut f6 = Vec::new();
let mut f7 = Vec::new();
let mut f8 = Vec::new();
let mut f9 = Vec::new();
let mut f10 = Vec::new();
let mut f11 = Vec::new();
let mut f12 = None;
let mut f13 = None;
let mut f14 = None;
let mut f15 = None;
let mut f16 = None;
let mut f17 = Vec::new();
let mut f18 = None;
let mut f19 = Vec::new();
let mut f20 = None;
let mut f21 = None;
let mut f22 = None;
let mut f23 = None;
let mut f24 = None;
let mut f25 = None;
let mut f26 = Vec::new();
let mut f27 = None;
let mut f28 = None;
let mut f29 = None;
let mut f30 = None;
let mut f31 = None;
let mut f32 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1345 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
225 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f3.push(v); } } },
1043 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
545 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
25 => if r.first(&mut seen[6])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<AccessibilityEnum>()? { f6.push(v); } } },
61 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f7.push(v); } } },
739 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalIdentifier::read_json(r)? { f8.push(v); } } },
992 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::UrlLink::read_json(r)? { f9.push(v); } } },
1573 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::UrlLink::read_json(r)? { f10.push(v); } } },
1572 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Image::read_json(r)? { f11.push(v); } } },
1469 => if r.first(&mut seen[12])? { f12 = OperatingHours::read_json(r)?; },
1240 => if r.first(&mut seen[13])? { f13 = loc::LocationReference::read_json(r)?; },
1520 => if r.first(&mut seen[14])? { f14 = Organisation::read_json(r)?; },
1483 => if r.first(&mut seen[15])? { f15 = Organisation::read_json(r)?; },
953 => if r.first(&mut seen[16])? { f16 = Organisation::read_json(r)?; },
263 => if r.first(&mut seen[17])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyAssociatedFacility::read_json(r)? { f17.push(v); } } },
1807 => if r.first(&mut seen[18])? { f18 = Rates::read_json(r)?; },
250 => if r.first(&mut seen[19])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::VehicleCharacteristics::read_json(r)? { f19.push(v); } } },
560 => if r.first(&mut seen[20])? { f20 = Dimension::read_json(r)?.map(Box::new); },
236 => if r.first(&mut seen[21])? { f21 = Amenities::read_json(r)?.map(Box::new); },
131 => if r.first(&mut seen[22])? { f22 = r.raw_object()?.map(Box::new); },
272 => if r.first(&mut seen[23])? { f23 = r.enumeration::<AvailabilityEnum>()?; },
1783 => if r.first(&mut seen[24])? { f24 = r.number::<u64>()?; },
1837 => if r.first(&mut seen[25])? { f25 = r.boolean()?; },
249 => if r.first(&mut seen[26])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<UserTypeEnum>()? { f26.push(v); } } },
1355 => if r.first(&mut seen[27])? { f27 = r.boolean()?; },
185 => if r.first(&mut seen[28])? { f28 = r.raw_object()?.map(Box::new); },
2031 => if r.first(&mut seen[29])? { f29 = r.enumeration::<ServiceFacilityTypeEnum>()?; },
1404 => if r.first(&mut seen[30])? { f30 = r.number::<u64>()?; },
587 => if r.first(&mut seen[31])? { f31 = r.number::<u64>()?; },
188 => if r.first(&mut seen[32])? { f32 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f29, 2031);
Ok(Self {
id: f0,
version: f1,
name: f2,
alias: f3,
last_updated: f4,
description: f5,
accessibility: f6,
additional_information: f7,
external_identifier: f8,
information_website: f9,
photo_url: f10,
photo: f11,
operating_hours: f12,
location_reference: f13,
owner: f14,
operator: f15,
helpdesk: f16,
associated_facility: f17,
rates: f18,
applicable_for_vehicles: f19,
dimension: f20,
amenities: f21,
facility_object_extension: f22,
availability: f23,
quantity: f24,
regularly_cleaned: f25,
applicable_for_user: f26,
nearby: f27,
supplemental_facility_extension: f28,
service_facility_type: f29,
number_of_subitems: f30,
distance_from_origin_facility: f31,
supplemental_service_facility_extension: f32,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(131)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.name {
w.key(1345)?;
w.multilingual(v)?;
}
if !self.alias.is_empty() {
w.key(225)?;
w.begin_array()?;
for v in &self.alias {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.last_updated {
w.key(1043)?;
w.date_time(v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(v)?;
}
if !self.accessibility.is_empty() {
w.key(25)?;
w.begin_array()?;
for v in &self.accessibility {
w.item()?;
w.enumeration(53, v.literal())?;
}
w.end_array()?;
}
if !self.additional_information.is_empty() {
w.key(61)?;
w.begin_array()?;
for v in &self.additional_information {
w.item()?;
w.multilingual(v)?;
}
w.end_array()?;
}
if !self.external_identifier.is_empty() {
w.key(739)?;
w.begin_array()?;
for v in &self.external_identifier {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.information_website.is_empty() {
w.key(992)?;
w.begin_array()?;
for v in &self.information_website {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.photo_url.is_empty() {
w.key(1573)?;
w.begin_array()?;
for v in &self.photo_url {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.photo.is_empty() {
w.key(1572)?;
w.begin_array()?;
for v in &self.photo {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.operating_hours {
w.key(1469)?;
v.write_json(w)?;
}
if let Some(v) = &self.location_reference {
w.key(1240)?;
v.write_json(w)?;
}
if let Some(v) = &self.owner {
w.key(1520)?;
v.write_json(w)?;
}
if let Some(v) = &self.operator {
w.key(1483)?;
v.write_json(w)?;
}
if let Some(v) = &self.helpdesk {
w.key(953)?;
v.write_json(w)?;
}
if !self.associated_facility.is_empty() {
w.key(263)?;
w.begin_array()?;
for v in &self.associated_facility {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.rates {
w.key(1807)?;
v.write_json(w)?;
}
if !self.applicable_for_vehicles.is_empty() {
w.key(250)?;
w.begin_array()?;
for v in &self.applicable_for_vehicles {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.dimension {
w.key(560)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.amenities {
w.key(236)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.facility_object_extension {
w.key(131)?;
w.extension(v)?;
}
if let Some(v) = &self.availability {
w.key(272)?;
w.enumeration(62, v.literal())?;
}
if let Some(v) = &self.quantity {
w.key(1783)?;
w.integer(*v)?;
}
if let Some(v) = &self.regularly_cleaned {
w.key(1837)?;
w.boolean(*v)?;
}
if !self.applicable_for_user.is_empty() {
w.key(249)?;
w.begin_array()?;
for v in &self.applicable_for_user {
w.item()?;
w.enumeration(144, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.nearby {
w.key(1355)?;
w.boolean(*v)?;
}
if let Some(v) = &self.supplemental_facility_extension {
w.key(185)?;
w.extension(v)?;
}
match &self.service_facility_type {
Some(v) => {
w.key(2031)?;
w.enumeration(127, v.literal())?;
}
None => w.absent(2031, w.missing("serviceFacilityType"))?,
}
if let Some(v) = &self.number_of_subitems {
w.key(1404)?;
w.integer(*v)?;
}
if let Some(v) = &self.distance_from_origin_facility {
w.key(587)?;
w.integer(*v)?;
}
if let Some(v) = &self.supplemental_service_facility_extension {
w.key(188)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:Surcharge`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Surcharge {
/// XML element `afac:surchargeType`.
pub surcharge_type: Option<SurchargeTypeEnum>,
/// XML element `afac:value`.
pub value: Option<AmountOfMoney>,
/// XML element `afac:rate`.
pub rate: Option<com::Percentage>,
/// XML element `afac:trigger`.
pub trigger: Option<MultilingualString>,
/// XML element `afac:refund`.
pub refund: Option<RefundTypeEnum>,
/// XML element `afac:labelForDisplay`.
pub label_for_display: Option<MultilingualString>,
/// XML element `afac:_surchargeExtension`.
pub surcharge_extension: Option<Box<Extension>>,
}
impl Surcharge {
const FIELDS: &'static [u32] = &[0x20bf8, 0x20c8c, 0x20ae4, 0x20c57, 0x20b11, 0x208e8, 0x2060f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20217);
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 {
0x20bf8 => { let v = r.enumeration::<SurchargeTypeEnum>()?; r.set(&mut e0, v, 3064); }
0x20c8c => { let v = r.value::<Decimal>()?; r.set(&mut e1, v, 3212); }
0x20ae4 => { let v = r.value::<f32>()?; r.set(&mut e2, v, 2788); }
0x20c57 => { let v = r.multilingual()?; r.set(&mut e3, v, 3159); }
0x20b11 => { let v = r.enumeration::<RefundTypeEnum>()?; r.set(&mut e4, v, 2833); }
0x208e8 => { let v = r.multilingual()?; r.set(&mut e5, v, 2280); }
0x2060f => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1551); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3064);
let v = Self {
surcharge_type: e0,
value: e1,
rate: e2,
trigger: e3,
refund: e4,
label_for_display: e5,
surcharge_extension: e6,
};
r.close();
Ok(v)
}
}
impl Surcharge {
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.surcharge_type {
Some(v) => { w.enumeration("afac:surchargeType", v.literal())?; }
None => return Err(w.missing("afac:surchargeType")),
}
if let Some(v) = &self.value { w.digits("value", v, 8, 2)?; w.leaf("afac:value", v)?; }
if let Some(v) = &self.rate { w.leaf("afac:rate", v)?; }
if let Some(v) = &self.trigger { w.multilingual("afac:trigger", v)?; }
if let Some(v) = &self.refund { w.enumeration("afac:refund", v.literal())?; }
if let Some(v) = &self.label_for_display { w.multilingual("afac:labelForDisplay", v)?; }
if let Some(v) = &self.surcharge_extension { w.extension("afac:_surchargeExtension", v)?; }
w.end(tag)
}
}
impl Surcharge {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2227 => if r.first(&mut seen[0])? { f0 = r.enumeration::<SurchargeTypeEnum>()?; },
2545 => if r.first(&mut seen[1])? { f1 = r.number::<Decimal>()?; },
1788 => if r.first(&mut seen[2])? { f2 = r.number::<f32>()?; },
2384 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1833 => if r.first(&mut seen[4])? { f4 = r.enumeration::<RefundTypeEnum>()?; },
1027 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
189 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2227);
Ok(Self {
surcharge_type: f0,
value: f1,
rate: f2,
trigger: f3,
refund: f4,
label_for_display: f5,
surcharge_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(132)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.surcharge_type {
Some(v) => {
w.key(2227)?;
w.enumeration(133, v.literal())?;
}
None => w.absent(2227, w.missing("surchargeType"))?,
}
if let Some(v) = &self.value {
w.key(2545)?;
w.digits("value", v, 8, 2)?; w.decimal(v)?;
}
if let Some(v) = &self.rate {
w.key(1788)?;
w.float32(*v)?;
}
if let Some(v) = &self.trigger {
w.key(2384)?;
w.multilingual(v)?;
}
if let Some(v) = &self.refund {
w.key(1833)?;
w.enumeration(121, v.literal())?;
}
if let Some(v) = &self.label_for_display {
w.key(1027)?;
w.multilingual(v)?;
}
if let Some(v) = &self.surcharge_extension {
w.key(189)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:TimesOfDay`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TimesOfDay {
/// XML element `afac:_assignedRightTimeRelativeExtension`.
pub assigned_right_time_relative_extension: Option<Box<Extension>>,
/// XML element `afac:earliestStart`.
pub earliest_start: Option<Time>,
/// XML element `afac:latestStart`.
pub latest_start: Option<Time>,
/// XML element `afac:earliestEnd`.
pub earliest_end: Option<Time>,
/// XML element `afac:latestEnd`.
pub latest_end: Option<Time>,
/// XML element `afac:_timesOfDayExtension`.
pub times_of_day_extension: Option<Box<Extension>>,
}
impl TimesOfDay {
const FIELDS: &'static [u32] = &[0x2043e, 0x207e7, 0x208fb, 0x207e5, 0x208f9, 0x20620];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20228);
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 {
0x2043e => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1086); }
0x207e7 => { let v = r.value::<Time>()?; r.set(&mut e1, v, 2023); }
0x208fb => { let v = r.value::<Time>()?; r.set(&mut e2, v, 2299); }
0x207e5 => { let v = r.value::<Time>()?; r.set(&mut e3, v, 2021); }
0x208f9 => { let v = r.value::<Time>()?; r.set(&mut e4, v, 2297); }
0x20620 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1568); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
assigned_right_time_relative_extension: e0,
earliest_start: e1,
latest_start: e2,
earliest_end: e3,
latest_end: e4,
times_of_day_extension: e5,
};
r.close();
Ok(v)
}
}
impl TimesOfDay {
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.assigned_right_time_relative_extension { w.extension("afac:_assignedRightTimeRelativeExtension", v)?; }
if let Some(v) = &self.earliest_start { w.leaf("afac:earliestStart", v)?; }
if let Some(v) = &self.latest_start { w.leaf("afac:latestStart", v)?; }
if let Some(v) = &self.earliest_end { w.leaf("afac:earliestEnd", v)?; }
if let Some(v) = &self.latest_end { w.leaf("afac:latestEnd", v)?; }
if let Some(v) = &self.times_of_day_extension { w.extension("afac:_timesOfDayExtension", v)?; }
w.end(tag)
}
}
impl TimesOfDay {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
114 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
608 => if r.first(&mut seen[1])? { f1 = r.text::<Time>()?; },
1046 => if r.first(&mut seen[2])? { f2 = r.text::<Time>()?; },
606 => if r.first(&mut seen[3])? { f3 = r.text::<Time>()?; },
1044 => if r.first(&mut seen[4])? { f4 = r.text::<Time>()?; },
191 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
assigned_right_time_relative_extension: f0,
earliest_start: f1,
latest_start: f2,
earliest_end: f3,
latest_end: f4,
times_of_day_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(134)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.assigned_right_time_relative_extension {
w.key(114)?;
w.extension(v)?;
}
if let Some(v) = &self.earliest_start {
w.key(608)?;
w.time(v)?;
}
if let Some(v) = &self.latest_start {
w.key(1046)?;
w.time(v)?;
}
if let Some(v) = &self.earliest_end {
w.key(606)?;
w.time(v)?;
}
if let Some(v) = &self.latest_end {
w.key(1044)?;
w.time(v)?;
}
if let Some(v) = &self.times_of_day_extension {
w.key(191)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UndefinedOperatingHours`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UndefinedOperatingHours {
/// XML element `afac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `afac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `afac:_undefinedOperatingHoursExtension`.
pub undefined_operating_hours_extension: Option<Box<Extension>>,
}
impl UndefinedOperatingHours {
const FIELDS: &'static [u32] = &[0x2074a, 0x2054d, 0x20653];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2025b);
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 {
0x2074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0x2054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0x20653 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1619); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
closure_information: e0,
operating_hours_extension: e1,
undefined_operating_hours_extension: e2,
};
r.close();
Ok(v)
}
}
impl UndefinedOperatingHours {
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.closure_information { v.write(w, "afac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("afac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.undefined_operating_hours_extension { w.extension("afac:_undefinedOperatingHoursExtension", v)?; }
w.end(tag)
}
}
impl UndefinedOperatingHours {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
344 => if r.first(&mut seen[0])? { f0 = ClosureInformation::read_json(r)?.map(Box::new); },
145 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
193 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
closure_information: f0,
operating_hours_extension: f1,
undefined_operating_hours_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(136)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.closure_information {
w.key(344)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.operating_hours_extension {
w.key(145)?;
w.extension(v)?;
}
if let Some(v) = &self.undefined_operating_hours_extension {
w.key(193)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UndefinedOrganisation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UndefinedOrganisation {
/// XML element `afac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `afac:_undefinedOrganisationExtension`.
pub undefined_organisation_extension: Option<Box<Extension>>,
}
impl UndefinedOrganisation {
const FIELDS: &'static [u32] = &[0x2087b, 0x2055a, 0x20654];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2025c);
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 {
0x2087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0x2055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0x20654 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1620); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
general_time_validity: e0,
organisation_extension: e1,
undefined_organisation_extension: e2,
};
r.close();
Ok(v)
}
}
impl UndefinedOrganisation {
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.general_time_validity { v.write(w, "afac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("afac:_organisationExtension", v)?; }
if let Some(v) = &self.undefined_organisation_extension { w.extension("afac:_undefinedOrganisationExtension", v)?; }
w.end(tag)
}
}
impl UndefinedOrganisation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
916 => if r.first(&mut seen[0])? { f0 = com::OverallPeriod::read_json(r)?.map(Box::new); },
153 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
195 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
general_time_validity: f0,
organisation_extension: f1,
undefined_organisation_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(137)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.general_time_validity {
w.key(916)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.organisation_extension {
w.key(153)?;
w.extension(v)?;
}
if let Some(v) = &self.undefined_organisation_extension {
w.key(195)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UnknownOperatingHours`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnknownOperatingHours {
/// XML element `afac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `afac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `afac:_unknownOperatingHoursExtension`.
pub unknown_operating_hours_extension: Option<Box<Extension>>,
}
impl UnknownOperatingHours {
const FIELDS: &'static [u32] = &[0x2074a, 0x2054d, 0x20655];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2025d);
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 {
0x2074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0x2054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0x20655 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1621); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
closure_information: e0,
operating_hours_extension: e1,
unknown_operating_hours_extension: e2,
};
r.close();
Ok(v)
}
}
impl UnknownOperatingHours {
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.closure_information { v.write(w, "afac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("afac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.unknown_operating_hours_extension { w.extension("afac:_unknownOperatingHoursExtension", v)?; }
w.end(tag)
}
}
impl UnknownOperatingHours {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
344 => if r.first(&mut seen[0])? { f0 = ClosureInformation::read_json(r)?.map(Box::new); },
145 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
197 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
closure_information: f0,
operating_hours_extension: f1,
unknown_operating_hours_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(139)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.closure_information {
w.key(344)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.operating_hours_extension {
w.key(145)?;
w.extension(v)?;
}
if let Some(v) = &self.unknown_operating_hours_extension {
w.key(197)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UnknownOrganisation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnknownOrganisation {
/// XML element `afac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `afac:_unknownOrganisationExtension`.
pub unknown_organisation_extension: Option<Box<Extension>>,
}
impl UnknownOrganisation {
const FIELDS: &'static [u32] = &[0x2087b, 0x2055a, 0x20656];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2025e);
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 {
0x2087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0x2055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0x20656 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1622); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
general_time_validity: e0,
organisation_extension: e1,
unknown_organisation_extension: e2,
};
r.close();
Ok(v)
}
}
impl UnknownOrganisation {
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.general_time_validity { v.write(w, "afac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("afac:_organisationExtension", v)?; }
if let Some(v) = &self.unknown_organisation_extension { w.extension("afac:_unknownOrganisationExtension", v)?; }
w.end(tag)
}
}
impl UnknownOrganisation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
916 => if r.first(&mut seen[0])? { f0 = com::OverallPeriod::read_json(r)?.map(Box::new); },
153 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
199 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
general_time_validity: f0,
organisation_extension: f1,
unknown_organisation_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(140)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.general_time_validity {
w.key(916)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.organisation_extension {
w.key(153)?;
w.extension(v)?;
}
if let Some(v) = &self.unknown_organisation_extension {
w.key(199)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UnknownRates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnknownRates {
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:_unknownRatesExtension`.
pub unknown_rates_extension: Option<Box<Extension>>,
}
impl UnknownRates {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x20657];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x2025f);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x20657 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1623); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
unknown_rates_extension: e4,
};
r.close();
Ok(v)
}
}
impl UnknownRates {
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)?;
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
if let Some(v) = &self.unknown_rates_extension { w.extension("afac:_unknownRatesExtension", v)?; }
w.end(tag)
}
}
impl UnknownRates {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
243 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
1545 => if r.first(&mut seen[1])? { f1 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
201 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment: f1,
overall_period: f2,
rates_extension: f3,
unknown_rates_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(141)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
if let Some(v) = &self.unknown_rates_extension {
w.key(201)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UnspecifiedRates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnspecifiedRates {
/// XML element `afac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `afac:payment`.
pub payment: Option<Box<Payment>>,
/// XML element `afac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `afac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `afac:_unspecifiedRatesExtension`.
pub unspecified_rates_extension: Option<Box<Extension>>,
}
impl UnspecifiedRates {
const FIELDS: &'static [u32] = &[0x206e8, 0x20a56, 0x20a36, 0x205b0, 0x20658];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20260);
r.attrs_done();
let mut e0 = Vec::new();
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 {
0x206e8 => { let v = r.string()?; e0.extend(v); }
0x20a56 => { let v = Some(Payment::read(r)?); r.set(&mut e1, v.map(Box::new), 2646); }
0x20a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0x205b0 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1456); }
0x20658 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1624); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_currency: e0,
payment: e1,
overall_period: e2,
rates_extension: e3,
unspecified_rates_extension: e4,
};
r.close();
Ok(v)
}
}
impl UnspecifiedRates {
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)?;
for v in &self.applicable_currency { w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.leaf("afac:applicableCurrency", v)?; }
if let Some(v) = &self.payment { v.write(w, "afac:payment", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "afac:overallPeriod", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("afac:_ratesExtension", v)?; }
if let Some(v) = &self.unspecified_rates_extension { w.extension("afac:_unspecifiedRatesExtension", v)?; }
w.end(tag)
}
}
impl UnspecifiedRates {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
243 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f0.push(v); } } },
1545 => if r.first(&mut seen[1])? { f1 = Payment::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
173 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
203 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment: f1,
overall_period: f2,
rates_extension: f3,
unspecified_rates_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(142)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.applicable_currency.is_empty() {
w.key(243)?;
w.begin_array()?;
for v in &self.applicable_currency {
w.item()?;
w.max_len("applicableCurrency", v, 1024)?; w.pattern("applicableCurrency", v, Pattern::CurrencyCode)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment {
w.key(1545)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.overall_period {
w.key(1513)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(173)?;
w.extension(v)?;
}
if let Some(v) = &self.unspecified_rates_extension {
w.key(203)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `afac:UserQualification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UserQualification {
/// XML element `afac:userGroup`.
pub user_group: Option<UserTypeEnum>,
/// XML element `afac:_userQualificationExtension`.
pub user_qualification_extension: Option<Box<Extension>>,
}
impl UserQualification {
const FIELDS: &'static [u32] = &[0x20c7b, 0x2065c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x20264);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x20c7b => { let v = r.enumeration::<UserTypeEnum>()?; r.set(&mut e0, v, 3195); }
0x2065c => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1628); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3195);
let v = Self {
user_group: e0,
user_qualification_extension: e1,
};
r.close();
Ok(v)
}
}
impl UserQualification {
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.user_group {
Some(v) => { w.enumeration("afac:userGroup", v.literal())?; }
None => return Err(w.missing("afac:userGroup")),
}
if let Some(v) = &self.user_qualification_extension { w.extension("afac:_userQualificationExtension", v)?; }
w.end(tag)
}
}
impl UserQualification {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2528 => if r.first(&mut seen[0])? { f0 = r.enumeration::<UserTypeEnum>()?; },
204 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2528);
Ok(Self {
user_group: f0,
user_qualification_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(143)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.user_group {
Some(v) => {
w.key(2528)?;
w.enumeration(144, v.literal())?;
}
None => w.absent(2528, w.missing("userGroup"))?,
}
if let Some(v) = &self.user_qualification_extension {
w.key(204)?;
w.extension(v)?;
}
w.end_object()
}
}
/// Any concrete kind of XML type `afac:AnOrganisation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyAnOrganisation {
/// XML type `afac:AnOrganisation`.
AnOrganisation(Box<AnOrganisation>),
/// XML type `afac:ReferenceableOrganisation`.
ReferenceableOrganisation(Box<ReferenceableOrganisation>),
}
impl AnyAnOrganisation {
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(0x20032) => Self::AnOrganisation(Box::new(AnOrganisation::read(r)?)),
Some(0x201b7) => Self::ReferenceableOrganisation(Box::new(ReferenceableOrganisation::read(r)?)),
None => Self::AnOrganisation(Box::new(AnOrganisation::read(r)?)),
_ => {
r.unknown_type_as("AnOrganisation");
Self::AnOrganisation(Box::new(AnOrganisation::read(r)?))
}
}))
}
/// XML element `afac:generalTimeValidity`, which every kind has.
pub fn general_time_validity(&self) -> Option<&com::OverallPeriod> {
match self {
Self::AnOrganisation(v) => v.general_time_validity.as_deref(),
Self::ReferenceableOrganisation(v) => v.general_time_validity.as_deref(),
}
}
/// XML element `afac:_organisationExtension`, which every kind has.
pub fn organisation_extension(&self) -> Option<&Extension> {
match self {
Self::AnOrganisation(v) => v.organisation_extension.as_deref(),
Self::ReferenceableOrganisation(v) => v.organisation_extension.as_deref(),
}
}
/// XML element `afac:lastUpdated`, which every kind has.
pub fn last_updated(&self) -> Option<&DateTime> {
match self {
Self::AnOrganisation(v) => v.last_updated.as_ref(),
Self::ReferenceableOrganisation(v) => v.last_updated.as_ref(),
}
}
/// XML element `afac:name`, which every kind has.
pub fn name(&self) -> Option<&MultilingualString> {
match self {
Self::AnOrganisation(v) => v.name.as_ref(),
Self::ReferenceableOrganisation(v) => v.name.as_ref(),
}
}
/// XML element `afac:legalName`, which every kind has.
pub fn legal_name(&self) -> Option<&MultilingualString> {
match self {
Self::AnOrganisation(v) => v.legal_name.as_ref(),
Self::ReferenceableOrganisation(v) => v.legal_name.as_ref(),
}
}
/// XML element `afac:description`, which every kind has.
pub fn description(&self) -> Option<&MultilingualString> {
match self {
Self::AnOrganisation(v) => v.description.as_ref(),
Self::ReferenceableOrganisation(v) => v.description.as_ref(),
}
}
/// XML element `afac:linkToGeneralInformation`, which every kind has.
pub fn link_to_general_information(&self) -> Option<&str> {
match self {
Self::AnOrganisation(v) => v.link_to_general_information.as_deref(),
Self::ReferenceableOrganisation(v) => v.link_to_general_information.as_deref(),
}
}
/// XML element `afac:linkToLogo`, which every kind has.
pub fn link_to_logo(&self) -> Option<&str> {
match self {
Self::AnOrganisation(v) => v.link_to_logo.as_deref(),
Self::ReferenceableOrganisation(v) => v.link_to_logo.as_deref(),
}
}
/// XML element `afac:linkToWebform`, which every kind has.
pub fn link_to_webform(&self) -> Option<&str> {
match self {
Self::AnOrganisation(v) => v.link_to_webform.as_deref(),
Self::ReferenceableOrganisation(v) => v.link_to_webform.as_deref(),
}
}
/// XML element `afac:available24hours`, which every kind has.
pub fn available24hours(&self) -> Option<&com::Boolean> {
match self {
Self::AnOrganisation(v) => v.available24hours.as_ref(),
Self::ReferenceableOrganisation(v) => v.available24hours.as_ref(),
}
}
/// XML element `afac:responsibility`, which every kind has.
pub fn responsibility(&self) -> &[MultilingualString] {
match self {
Self::AnOrganisation(v) => &v.responsibility,
Self::ReferenceableOrganisation(v) => &v.responsibility,
}
}
/// XML element `afac:publishingAgreement`, which every kind has.
pub fn publishing_agreement(&self) -> Option<&com::Boolean> {
match self {
Self::AnOrganisation(v) => v.publishing_agreement.as_ref(),
Self::ReferenceableOrganisation(v) => v.publishing_agreement.as_ref(),
}
}
/// XML element `afac:type`, which every kind has.
pub fn r#type(&self) -> Option<&OrganisationTypeEnum> {
match self {
Self::AnOrganisation(v) => v.r#type.as_ref(),
Self::ReferenceableOrganisation(v) => v.r#type.as_ref(),
}
}
/// XML element `afac:nationalOrganisationNumber`, which every kind has.
pub fn national_organisation_number(&self) -> Option<&str> {
match self {
Self::AnOrganisation(v) => v.national_organisation_number.as_deref(),
Self::ReferenceableOrganisation(v) => v.national_organisation_number.as_deref(),
}
}
/// XML element `afac:nationalRegister`, which every kind has.
pub fn national_register(&self) -> Option<&str> {
match self {
Self::AnOrganisation(v) => v.national_register.as_deref(),
Self::ReferenceableOrganisation(v) => v.national_register.as_deref(),
}
}
/// XML element `afac:vatIdentificationNumber`, which every kind has.
pub fn vat_identification_number(&self) -> Option<&str> {
match self {
Self::AnOrganisation(v) => v.vat_identification_number.as_deref(),
Self::ReferenceableOrganisation(v) => v.vat_identification_number.as_deref(),
}
}
/// XML element `afac:organisationUnit`, which every kind has.
pub fn organisation_unit(&self) -> &[OrganisationUnit] {
match self {
Self::AnOrganisation(v) => &v.organisation_unit,
Self::ReferenceableOrganisation(v) => &v.organisation_unit,
}
}
/// XML element `afac:externalIdentifier`, which every kind has.
pub fn external_identifier(&self) -> &[ExternalIdentifier] {
match self {
Self::AnOrganisation(v) => &v.external_identifier,
Self::ReferenceableOrganisation(v) => &v.external_identifier,
}
}
/// XML element `afac:subOrganisation`, which every kind has.
pub fn sub_organisation(&self) -> &[Organisation] {
match self {
Self::AnOrganisation(v) => &v.sub_organisation,
Self::ReferenceableOrganisation(v) => &v.sub_organisation,
}
}
/// XML element `afac:_anOrganisationExtension`, which every kind has.
pub fn an_organisation_extension(&self) -> Option<&Extension> {
match self {
Self::AnOrganisation(v) => v.an_organisation_extension.as_deref(),
Self::ReferenceableOrganisation(v) => v.an_organisation_extension.as_deref(),
}
}
}
impl AnyAnOrganisation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AnOrganisation(v) => v.write(w, tag, "", ""),
Self::ReferenceableOrganisation(v) => v.write(w, tag, " xsi:type=\"afac:ReferenceableOrganisation\"", ""),
}
}
}
impl AnyAnOrganisation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 112 | 176) {
return AnOrganisation::read_json_members(r, Some(key)).map(|v| Some(Self::AnOrganisation(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
112 => if r.first(&mut seen)? { value = AnOrganisation::read_json(r)?.map(|v| Self::AnOrganisation(Box::new(v))); },
176 => if r.first(&mut seen)? { value = ReferenceableOrganisation::read_json(r)?.map(|v| Self::ReferenceableOrganisation(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of AnOrganisation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AnOrganisation(v) => {
if w.wrapper(112)? {
w.begin_object(58)?;
w.key(112)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::ReferenceableOrganisation(v) => {
if w.wrapper(176)? {
w.begin_object(58)?;
w.key(176)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:AssignedRightTimeRelative`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AssignedRightTimeRelative {
/// XML type `afac:RelativeOffsets`.
RelativeOffsets(Box<RelativeOffsets>),
/// XML type `afac:TimesOfDay`.
TimesOfDay(Box<TimesOfDay>),
}
impl AssignedRightTimeRelative {
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(0x201be) => Self::RelativeOffsets(Box::new(RelativeOffsets::read(r)?)),
Some(0x20228) => Self::TimesOfDay(Box::new(TimesOfDay::read(r)?)),
_ => {
r.unknown_type("AssignedRightTimeRelative")?;
return Ok(None);
}
}))
}
/// XML element `afac:_assignedRightTimeRelativeExtension`, which every kind has.
pub fn assigned_right_time_relative_extension(&self) -> Option<&Extension> {
match self {
Self::RelativeOffsets(v) => v.assigned_right_time_relative_extension.as_deref(),
Self::TimesOfDay(v) => v.assigned_right_time_relative_extension.as_deref(),
}
}
}
impl AssignedRightTimeRelative {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::RelativeOffsets(v) => v.write(w, tag, " xsi:type=\"afac:RelativeOffsets\"", ""),
Self::TimesOfDay(v) => v.write(w, tag, " xsi:type=\"afac:TimesOfDay\"", ""),
}
}
}
impl AssignedRightTimeRelative {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
178 => if r.first(&mut seen)? { value = RelativeOffsets::read_json(r)?.map(|v| Self::RelativeOffsets(Box::new(v))); },
190 => if r.first(&mut seen)? { value = TimesOfDay::read_json(r)?.map(|v| Self::TimesOfDay(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of AssignedRightTimeRelative in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::RelativeOffsets(v) => {
if w.wrapper(178)? {
w.begin_object(59)?;
w.key(178)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::TimesOfDay(v) => {
if w.wrapper(190)? {
w.begin_object(59)?;
w.key(190)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:AssociatedFacility`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyAssociatedFacility {
/// XML type `afac:AssociatedFacility`.
AssociatedFacility(Box<AssociatedFacility>),
/// XML type `aegi:AssociatedParking`.
AssociatedParking(Box<aegi::AssociatedParking>),
}
impl AnyAssociatedFacility {
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(0x20039) => Self::AssociatedFacility(Box::new(AssociatedFacility::read(r)?)),
Some(0x1003a) => Self::AssociatedParking(Box::new(aegi::AssociatedParking::read(r)?)),
None => Self::AssociatedFacility(Box::new(AssociatedFacility::read(r)?)),
_ => {
r.unknown_type_as("AssociatedFacility");
Self::AssociatedFacility(Box::new(AssociatedFacility::read(r)?))
}
}))
}
/// XML element `afac:type`, which every kind has.
pub fn r#type(&self) -> Option<&FacilityTypeEnum> {
match self {
Self::AssociatedFacility(v) => v.r#type.as_ref(),
Self::AssociatedParking(v) => v.r#type.as_ref(),
}
}
/// XML element `afac:facilityReference`, which every kind has.
pub fn facility_reference(&self) -> Option<&com::VersionedReference> {
match self {
Self::AssociatedFacility(v) => v.facility_reference.as_deref(),
Self::AssociatedParking(v) => v.facility_reference.as_deref(),
}
}
/// XML element `afac:description`, which every kind has.
pub fn description(&self) -> Option<&MultilingualString> {
match self {
Self::AssociatedFacility(v) => v.description.as_ref(),
Self::AssociatedParking(v) => v.description.as_ref(),
}
}
/// XML element `afac:_associatedFacilityExtension`, which every kind has.
pub fn associated_facility_extension(&self) -> Option<&Extension> {
match self {
Self::AssociatedFacility(v) => v.associated_facility_extension.as_deref(),
Self::AssociatedParking(v) => v.associated_facility_extension.as_deref(),
}
}
}
impl AnyAssociatedFacility {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AssociatedFacility(v) => v.write(w, tag, "", ""),
Self::AssociatedParking(v) => v.write(w, tag, " xsi:type=\"aegi:AssociatedParking\"", ""),
}
}
}
impl AnyAssociatedFacility {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 115 | 71) {
return AssociatedFacility::read_json_members(r, Some(key)).map(|v| Some(Self::AssociatedFacility(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
115 => if r.first(&mut seen)? { value = AssociatedFacility::read_json(r)?.map(|v| Self::AssociatedFacility(Box::new(v))); },
71 => if r.first(&mut seen)? { value = aegi::AssociatedParking::read_json(r)?.map(|v| Self::AssociatedParking(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of AssociatedFacility in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AssociatedFacility(v) => {
if w.wrapper(115)? {
w.begin_object(61)?;
w.key(115)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::AssociatedParking(v) => {
if w.wrapper(71)? {
w.begin_object(61)?;
w.key(71)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:ContactInformation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyContactInformation {
/// XML type `afac:ContactInformation`.
ContactInformation(Box<ContactInformation>),
/// XML type `afac:ContactPerson`.
ContactPerson(Box<ContactPerson>),
}
impl AnyContactInformation {
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(0x2005e) => Self::ContactInformation(Box::new(ContactInformation::read(r)?)),
Some(0x2005f) => Self::ContactPerson(Box::new(ContactPerson::read(r)?)),
None => Self::ContactInformation(Box::new(ContactInformation::read(r)?)),
_ => {
r.unknown_type_as("ContactInformation");
Self::ContactInformation(Box::new(ContactInformation::read(r)?))
}
}))
}
/// XML element `afac:language`, which every kind has.
pub fn language(&self) -> &[com::Language] {
match self {
Self::ContactInformation(v) => &v.language,
Self::ContactPerson(v) => &v.language,
}
}
/// XML element `afac:telephoneNumber`, which every kind has.
pub fn telephone_number(&self) -> Option<&str> {
match self {
Self::ContactInformation(v) => v.telephone_number.as_deref(),
Self::ContactPerson(v) => v.telephone_number.as_deref(),
}
}
/// XML element `afac:faxNumber`, which every kind has.
pub fn fax_number(&self) -> Option<&str> {
match self {
Self::ContactInformation(v) => v.fax_number.as_deref(),
Self::ContactPerson(v) => v.fax_number.as_deref(),
}
}
/// XML element `afac:eMail`, which every kind has.
pub fn e_mail(&self) -> Option<&str> {
match self {
Self::ContactInformation(v) => v.e_mail.as_deref(),
Self::ContactPerson(v) => v.e_mail.as_deref(),
}
}
/// XML element `afac:_contactInformationExtension`, which every kind has.
pub fn contact_information_extension(&self) -> Option<&Extension> {
match self {
Self::ContactInformation(v) => v.contact_information_extension.as_deref(),
Self::ContactPerson(v) => v.contact_information_extension.as_deref(),
}
}
}
impl AnyContactInformation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::ContactInformation(v) => v.write(w, tag, "", ""),
Self::ContactPerson(v) => v.write(w, tag, " xsi:type=\"afac:ContactPerson\"", ""),
}
}
}
impl AnyContactInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 118 | 120) {
return ContactInformation::read_json_members(r, Some(key)).map(|v| Some(Self::ContactInformation(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
118 => if r.first(&mut seen)? { value = ContactInformation::read_json(r)?.map(|v| Self::ContactInformation(Box::new(v))); },
120 => if r.first(&mut seen)? { value = ContactPerson::read_json(r)?.map(|v| Self::ContactPerson(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of ContactInformation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::ContactInformation(v) => {
if w.wrapper(118)? {
w.begin_object(65)?;
w.key(118)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::ContactPerson(v) => {
if w.wrapper(120)? {
w.begin_object(65)?;
w.key(120)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:Credential`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyCredential {
/// XML type `afac:Credential`.
Credential(Box<Credential>),
/// XML type `afac:CredentialAssigned`.
CredentialAssigned(Box<CredentialAssigned>),
}
impl AnyCredential {
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(0x20066) => Self::Credential(Box::new(Credential::read(r)?)),
Some(0x20067) => Self::CredentialAssigned(Box::new(CredentialAssigned::read(r)?)),
None => Self::Credential(Box::new(Credential::read(r)?)),
_ => {
r.unknown_type_as("Credential");
Self::Credential(Box::new(Credential::read(r)?))
}
}))
}
/// XML element `afac:type`, which every kind has.
pub fn r#type(&self) -> Option<&CredentialTypeEnum> {
match self {
Self::Credential(v) => v.r#type.as_ref(),
Self::CredentialAssigned(v) => v.r#type.as_ref(),
}
}
/// XML element `afac:otherType`, which every kind has.
pub fn other_type(&self) -> Option<&str> {
match self {
Self::Credential(v) => v.other_type.as_deref(),
Self::CredentialAssigned(v) => v.other_type.as_deref(),
}
}
/// XML element `afac:_credentialExtension`, which every kind has.
pub fn credential_extension(&self) -> Option<&Extension> {
match self {
Self::Credential(v) => v.credential_extension.as_deref(),
Self::CredentialAssigned(v) => v.credential_extension.as_deref(),
}
}
}
impl AnyCredential {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::Credential(v) => v.write(w, tag, "", ""),
Self::CredentialAssigned(v) => v.write(w, tag, " xsi:type=\"afac:CredentialAssigned\"", ""),
}
}
}
impl AnyCredential {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 122 | 123) {
return Credential::read_json_members(r, Some(key)).map(|v| Some(Self::Credential(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
122 => if r.first(&mut seen)? { value = Credential::read_json(r)?.map(|v| Self::Credential(Box::new(v))); },
123 => if r.first(&mut seen)? { value = CredentialAssigned::read_json(r)?.map(|v| Self::CredentialAssigned(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Credential in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::Credential(v) => {
if w.wrapper(122)? {
w.begin_object(69)?;
w.key(122)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::CredentialAssigned(v) => {
if w.wrapper(123)? {
w.begin_object(69)?;
w.key(123)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:OperatingHours`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum OperatingHours {
/// XML type `afac:OpenAllHours`.
OpenAllHours(Box<OpenAllHours>),
/// XML type `afac:OperatingHoursByReference`.
OperatingHoursByReference(Box<OperatingHoursByReference>),
/// XML type `afac:OperatingHoursSpecification`.
OperatingHoursSpecification(Box<OperatingHoursSpecification>),
/// XML type `afac:UndefinedOperatingHours`.
UndefinedOperatingHours(Box<UndefinedOperatingHours>),
/// XML type `afac:UnknownOperatingHours`.
UnknownOperatingHours(Box<UnknownOperatingHours>),
}
impl OperatingHours {
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(0x20137) => Self::OpenAllHours(Box::new(OpenAllHours::read(r)?)),
Some(0x2014e) => Self::OperatingHoursByReference(Box::new(OperatingHoursByReference::read(r)?)),
Some(0x20150) => Self::OperatingHoursSpecification(Box::new(OperatingHoursSpecification::read(r)?)),
Some(0x2025b) => Self::UndefinedOperatingHours(Box::new(UndefinedOperatingHours::read(r)?)),
Some(0x2025d) => Self::UnknownOperatingHours(Box::new(UnknownOperatingHours::read(r)?)),
_ => {
r.unknown_type("OperatingHours")?;
return Ok(None);
}
}))
}
/// XML element `afac:closureInformation`, which every kind has.
pub fn closure_information(&self) -> Option<&ClosureInformation> {
match self {
Self::OpenAllHours(v) => v.closure_information.as_deref(),
Self::OperatingHoursByReference(v) => v.closure_information.as_deref(),
Self::OperatingHoursSpecification(v) => v.closure_information.as_deref(),
Self::UndefinedOperatingHours(v) => v.closure_information.as_deref(),
Self::UnknownOperatingHours(v) => v.closure_information.as_deref(),
}
}
/// XML element `afac:_operatingHoursExtension`, which every kind has.
pub fn operating_hours_extension(&self) -> Option<&Extension> {
match self {
Self::OpenAllHours(v) => v.operating_hours_extension.as_deref(),
Self::OperatingHoursByReference(v) => v.operating_hours_extension.as_deref(),
Self::OperatingHoursSpecification(v) => v.operating_hours_extension.as_deref(),
Self::UndefinedOperatingHours(v) => v.operating_hours_extension.as_deref(),
Self::UnknownOperatingHours(v) => v.operating_hours_extension.as_deref(),
}
}
}
impl OperatingHours {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::OpenAllHours(v) => v.write(w, tag, " xsi:type=\"afac:OpenAllHours\"", ""),
Self::OperatingHoursByReference(v) => v.write(w, tag, " xsi:type=\"afac:OperatingHoursByReference\"", ""),
Self::OperatingHoursSpecification(v) => v.write(w, tag, " xsi:type=\"afac:OperatingHoursSpecification\"", ""),
Self::UndefinedOperatingHours(v) => v.write(w, tag, " xsi:type=\"afac:UndefinedOperatingHours\"", ""),
Self::UnknownOperatingHours(v) => v.write(w, tag, " xsi:type=\"afac:UnknownOperatingHours\"", ""),
}
}
}
impl OperatingHours {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
141 => if r.first(&mut seen)? { value = OpenAllHours::read_json(r)?.map(|v| Self::OpenAllHours(Box::new(v))); },
143 => if r.first(&mut seen)? { value = OperatingHoursByReference::read_json(r)?.map(|v| Self::OperatingHoursByReference(Box::new(v))); },
148 => if r.first(&mut seen)? { value = OperatingHoursSpecification::read_json(r)?.map(|v| Self::OperatingHoursSpecification(Box::new(v))); },
192 => if r.first(&mut seen)? { value = UndefinedOperatingHours::read_json(r)?.map(|v| Self::UndefinedOperatingHours(Box::new(v))); },
196 => if r.first(&mut seen)? { value = UnknownOperatingHours::read_json(r)?.map(|v| Self::UnknownOperatingHours(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of OperatingHours in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::OpenAllHours(v) => {
if w.wrapper(141)? {
w.begin_object(90)?;
w.key(141)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OperatingHoursByReference(v) => {
if w.wrapper(143)? {
w.begin_object(90)?;
w.key(143)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OperatingHoursSpecification(v) => {
if w.wrapper(148)? {
w.begin_object(90)?;
w.key(148)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UndefinedOperatingHours(v) => {
if w.wrapper(192)? {
w.begin_object(90)?;
w.key(192)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnknownOperatingHours(v) => {
if w.wrapper(196)? {
w.begin_object(90)?;
w.key(196)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:Organisation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Organisation {
/// XML type `afac:AnOrganisation`.
AnOrganisation(Box<AnOrganisation>),
/// XML type `afac:ReferenceableOrganisation`.
ReferenceableOrganisation(Box<ReferenceableOrganisation>),
/// XML type `afac:OrganisationByReference`.
OrganisationByReference(Box<OrganisationByReference>),
/// XML type `afac:UndefinedOrganisation`.
UndefinedOrganisation(Box<UndefinedOrganisation>),
/// XML type `afac:UnknownOrganisation`.
UnknownOrganisation(Box<UnknownOrganisation>),
}
impl Organisation {
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(0x20032) => Self::AnOrganisation(Box::new(AnOrganisation::read(r)?)),
Some(0x201b7) => Self::ReferenceableOrganisation(Box::new(ReferenceableOrganisation::read(r)?)),
Some(0x2015c) => Self::OrganisationByReference(Box::new(OrganisationByReference::read(r)?)),
Some(0x2025c) => Self::UndefinedOrganisation(Box::new(UndefinedOrganisation::read(r)?)),
Some(0x2025e) => Self::UnknownOrganisation(Box::new(UnknownOrganisation::read(r)?)),
_ => {
r.unknown_type("Organisation")?;
return Ok(None);
}
}))
}
/// XML element `afac:generalTimeValidity`, which every kind has.
pub fn general_time_validity(&self) -> Option<&com::OverallPeriod> {
match self {
Self::AnOrganisation(v) => v.general_time_validity.as_deref(),
Self::ReferenceableOrganisation(v) => v.general_time_validity.as_deref(),
Self::OrganisationByReference(v) => v.general_time_validity.as_deref(),
Self::UndefinedOrganisation(v) => v.general_time_validity.as_deref(),
Self::UnknownOrganisation(v) => v.general_time_validity.as_deref(),
}
}
/// XML element `afac:_organisationExtension`, which every kind has.
pub fn organisation_extension(&self) -> Option<&Extension> {
match self {
Self::AnOrganisation(v) => v.organisation_extension.as_deref(),
Self::ReferenceableOrganisation(v) => v.organisation_extension.as_deref(),
Self::OrganisationByReference(v) => v.organisation_extension.as_deref(),
Self::UndefinedOrganisation(v) => v.organisation_extension.as_deref(),
Self::UnknownOrganisation(v) => v.organisation_extension.as_deref(),
}
}
}
impl Organisation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AnOrganisation(v) => v.write(w, tag, " xsi:type=\"afac:AnOrganisation\"", ""),
Self::ReferenceableOrganisation(v) => v.write(w, tag, " xsi:type=\"afac:ReferenceableOrganisation\"", ""),
Self::OrganisationByReference(v) => v.write(w, tag, " xsi:type=\"afac:OrganisationByReference\"", ""),
Self::UndefinedOrganisation(v) => v.write(w, tag, " xsi:type=\"afac:UndefinedOrganisation\"", ""),
Self::UnknownOrganisation(v) => v.write(w, tag, " xsi:type=\"afac:UnknownOrganisation\"", ""),
}
}
}
impl Organisation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
112 => if r.first(&mut seen)? { value = AnOrganisation::read_json(r)?.map(|v| Self::AnOrganisation(Box::new(v))); },
176 => if r.first(&mut seen)? { value = ReferenceableOrganisation::read_json(r)?.map(|v| Self::ReferenceableOrganisation(Box::new(v))); },
151 => if r.first(&mut seen)? { value = OrganisationByReference::read_json(r)?.map(|v| Self::OrganisationByReference(Box::new(v))); },
194 => if r.first(&mut seen)? { value = UndefinedOrganisation::read_json(r)?.map(|v| Self::UndefinedOrganisation(Box::new(v))); },
198 => if r.first(&mut seen)? { value = UnknownOrganisation::read_json(r)?.map(|v| Self::UnknownOrganisation(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Organisation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AnOrganisation(v) => {
if w.wrapper(112)? {
w.begin_object(96)?;
w.key(112)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::ReferenceableOrganisation(v) => {
if w.wrapper(176)? {
w.begin_object(96)?;
w.key(176)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OrganisationByReference(v) => {
if w.wrapper(151)? {
w.begin_object(96)?;
w.key(151)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UndefinedOrganisation(v) => {
if w.wrapper(194)? {
w.begin_object(96)?;
w.key(194)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnknownOrganisation(v) => {
if w.wrapper(198)? {
w.begin_object(96)?;
w.key(198)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:RateLineCollection`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyRateLineCollection {
/// XML type `afac:RateLineCollection`.
RateLineCollection(Box<RateLineCollection>),
/// XML type `afac:RelativeTimeRates`.
RelativeTimeRates(Box<RelativeTimeRates>),
}
impl AnyRateLineCollection {
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(0x201ac) => Self::RateLineCollection(Box::new(RateLineCollection::read(r)?)),
Some(0x201bf) => Self::RelativeTimeRates(Box::new(RelativeTimeRates::read(r)?)),
None => Self::RateLineCollection(Box::new(RateLineCollection::read(r)?)),
_ => {
r.unknown_type_as("RateLineCollection");
Self::RateLineCollection(Box::new(RateLineCollection::read(r)?))
}
}))
}
/// XML attribute `collectionSequence`, which every kind has.
pub fn collection_sequence(&self) -> Option<&com::Integer> {
match self {
Self::RateLineCollection(v) => v.collection_sequence.as_ref(),
Self::RelativeTimeRates(v) => v.collection_sequence.as_ref(),
}
}
/// XML element `afac:applicableCurrency`, which every kind has.
pub fn applicable_currency(&self) -> Option<&str> {
match self {
Self::RateLineCollection(v) => v.applicable_currency.as_deref(),
Self::RelativeTimeRates(v) => v.applicable_currency.as_deref(),
}
}
/// XML element `afac:minValueCollection`, which every kind has.
pub fn min_value_collection(&self) -> Option<&AmountOfMoney> {
match self {
Self::RateLineCollection(v) => v.min_value_collection.as_ref(),
Self::RelativeTimeRates(v) => v.min_value_collection.as_ref(),
}
}
/// XML element `afac:maxValueCollection`, which every kind has.
pub fn max_value_collection(&self) -> Option<&AmountOfMoney> {
match self {
Self::RateLineCollection(v) => v.max_value_collection.as_ref(),
Self::RelativeTimeRates(v) => v.max_value_collection.as_ref(),
}
}
/// XML element `afac:validStart`, which every kind has.
pub fn valid_start(&self) -> Option<&DateTime> {
match self {
Self::RateLineCollection(v) => v.valid_start.as_ref(),
Self::RelativeTimeRates(v) => v.valid_start.as_ref(),
}
}
/// XML element `afac:validEnd`, which every kind has.
pub fn valid_end(&self) -> Option<&DateTime> {
match self {
Self::RateLineCollection(v) => v.valid_end.as_ref(),
Self::RelativeTimeRates(v) => v.valid_end.as_ref(),
}
}
/// XML element `afac:minTime`, which every kind has.
pub fn min_time(&self) -> Option<&str> {
match self {
Self::RateLineCollection(v) => v.min_time.as_deref(),
Self::RelativeTimeRates(v) => v.min_time.as_deref(),
}
}
/// XML element `afac:maxTime`, which every kind has.
pub fn max_time(&self) -> Option<&str> {
match self {
Self::RateLineCollection(v) => v.max_time.as_deref(),
Self::RelativeTimeRates(v) => v.max_time.as_deref(),
}
}
/// XML element `afac:resetTime`, which every kind has.
pub fn reset_time(&self) -> Option<&Time> {
match self {
Self::RateLineCollection(v) => v.reset_time.as_ref(),
Self::RelativeTimeRates(v) => v.reset_time.as_ref(),
}
}
/// XML element `afac:taxIncluded`, which every kind has.
pub fn tax_included(&self) -> Option<&com::Boolean> {
match self {
Self::RateLineCollection(v) => v.tax_included.as_ref(),
Self::RelativeTimeRates(v) => v.tax_included.as_ref(),
}
}
/// XML element `afac:taxRate`, which every kind has.
pub fn tax_rate(&self) -> Option<&com::Percentage> {
match self {
Self::RateLineCollection(v) => v.tax_rate.as_ref(),
Self::RelativeTimeRates(v) => v.tax_rate.as_ref(),
}
}
/// XML element `afac:taxValue`, which every kind has.
pub fn tax_value(&self) -> Option<&AmountOfMoney> {
match self {
Self::RateLineCollection(v) => v.tax_value.as_ref(),
Self::RelativeTimeRates(v) => v.tax_value.as_ref(),
}
}
/// XML element `afac:relativeTimes`, which every kind has.
pub fn relative_times(&self) -> Option<&com::Boolean> {
match self {
Self::RateLineCollection(v) => v.relative_times.as_ref(),
Self::RelativeTimeRates(v) => v.relative_times.as_ref(),
}
}
/// XML element `afac:rateLine`, which every kind has.
pub fn rate_line(&self) -> &[RateLine] {
match self {
Self::RateLineCollection(v) => &v.rate_line,
Self::RelativeTimeRates(v) => &v.rate_line,
}
}
/// XML element `afac:_rateLineCollectionExtension`, which every kind has.
pub fn rate_line_collection_extension(&self) -> Option<&Extension> {
match self {
Self::RateLineCollection(v) => v.rate_line_collection_extension.as_deref(),
Self::RelativeTimeRates(v) => v.rate_line_collection_extension.as_deref(),
}
}
}
impl AnyRateLineCollection {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::RateLineCollection(v) => v.write(w, tag, "", ""),
Self::RelativeTimeRates(v) => v.write(w, tag, " xsi:type=\"afac:RelativeTimeRates\"", ""),
}
}
}
impl AnyRateLineCollection {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 161 | 180) {
return RateLineCollection::read_json_members(r, Some(key)).map(|v| Some(Self::RateLineCollection(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
161 => if r.first(&mut seen)? { value = RateLineCollection::read_json(r)?.map(|v| Self::RateLineCollection(Box::new(v))); },
180 => if r.first(&mut seen)? { value = RelativeTimeRates::read_json(r)?.map(|v| Self::RelativeTimeRates(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of RateLineCollection in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::RateLineCollection(v) => {
if w.wrapper(161)? {
w.begin_object(109)?;
w.key(161)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RelativeTimeRates(v) => {
if w.wrapper(180)? {
w.begin_object(109)?;
w.key(180)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:Rates`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Rates {
/// XML type `afac:FreeOfCharge`.
FreeOfCharge(Box<FreeOfCharge>),
/// XML type `afac:GeneralRateInformation`.
GeneralRateInformation(Box<GeneralRateInformation>),
/// XML type `afac:RateMatrix`.
RateMatrix(Box<RateMatrix>),
/// XML type `afac:RateMatrixByReference`.
RateMatrixByReference(Box<RateMatrixByReference>),
/// XML type `afac:RateTable`.
RateTable(Box<RateTable>),
/// XML type `afac:RateTableByReference`.
RateTableByReference(Box<RateTableByReference>),
/// XML type `afac:UnknownRates`.
UnknownRates(Box<UnknownRates>),
/// XML type `afac:UnspecifiedRates`.
UnspecifiedRates(Box<UnspecifiedRates>),
}
impl Rates {
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(0x200ba) => Self::FreeOfCharge(Box::new(FreeOfCharge::read(r)?)),
Some(0x200c7) => Self::GeneralRateInformation(Box::new(GeneralRateInformation::read(r)?)),
Some(0x201ae) => Self::RateMatrix(Box::new(RateMatrix::read(r)?)),
Some(0x201af) => Self::RateMatrixByReference(Box::new(RateMatrixByReference::read(r)?)),
Some(0x201b0) => Self::RateTable(Box::new(RateTable::read(r)?)),
Some(0x201b1) => Self::RateTableByReference(Box::new(RateTableByReference::read(r)?)),
Some(0x2025f) => Self::UnknownRates(Box::new(UnknownRates::read(r)?)),
Some(0x20260) => Self::UnspecifiedRates(Box::new(UnspecifiedRates::read(r)?)),
_ => {
r.unknown_type("Rates")?;
return Ok(None);
}
}))
}
/// XML element `afac:applicableCurrency`, which every kind has.
pub fn applicable_currency(&self) -> &[CurrencyCode] {
match self {
Self::FreeOfCharge(v) => &v.applicable_currency,
Self::GeneralRateInformation(v) => &v.applicable_currency,
Self::RateMatrix(v) => &v.applicable_currency,
Self::RateMatrixByReference(v) => &v.applicable_currency,
Self::RateTable(v) => &v.applicable_currency,
Self::RateTableByReference(v) => &v.applicable_currency,
Self::UnknownRates(v) => &v.applicable_currency,
Self::UnspecifiedRates(v) => &v.applicable_currency,
}
}
/// XML element `afac:payment`, which every kind has.
pub fn payment(&self) -> Option<&Payment> {
match self {
Self::FreeOfCharge(v) => v.payment.as_deref(),
Self::GeneralRateInformation(v) => v.payment.as_deref(),
Self::RateMatrix(v) => v.payment.as_deref(),
Self::RateMatrixByReference(v) => v.payment.as_deref(),
Self::RateTable(v) => v.payment.as_deref(),
Self::RateTableByReference(v) => v.payment.as_deref(),
Self::UnknownRates(v) => v.payment.as_deref(),
Self::UnspecifiedRates(v) => v.payment.as_deref(),
}
}
/// XML element `afac:overallPeriod`, which every kind has.
pub fn overall_period(&self) -> Option<&com::OverallPeriod> {
match self {
Self::FreeOfCharge(v) => v.overall_period.as_deref(),
Self::GeneralRateInformation(v) => v.overall_period.as_deref(),
Self::RateMatrix(v) => v.overall_period.as_deref(),
Self::RateMatrixByReference(v) => v.overall_period.as_deref(),
Self::RateTable(v) => v.overall_period.as_deref(),
Self::RateTableByReference(v) => v.overall_period.as_deref(),
Self::UnknownRates(v) => v.overall_period.as_deref(),
Self::UnspecifiedRates(v) => v.overall_period.as_deref(),
}
}
/// XML element `afac:_ratesExtension`, which every kind has.
pub fn rates_extension(&self) -> Option<&Extension> {
match self {
Self::FreeOfCharge(v) => v.rates_extension.as_deref(),
Self::GeneralRateInformation(v) => v.rates_extension.as_deref(),
Self::RateMatrix(v) => v.rates_extension.as_deref(),
Self::RateMatrixByReference(v) => v.rates_extension.as_deref(),
Self::RateTable(v) => v.rates_extension.as_deref(),
Self::RateTableByReference(v) => v.rates_extension.as_deref(),
Self::UnknownRates(v) => v.rates_extension.as_deref(),
Self::UnspecifiedRates(v) => v.rates_extension.as_deref(),
}
}
}
impl Rates {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::FreeOfCharge(v) => v.write(w, tag, " xsi:type=\"afac:FreeOfCharge\"", ""),
Self::GeneralRateInformation(v) => v.write(w, tag, " xsi:type=\"afac:GeneralRateInformation\"", ""),
Self::RateMatrix(v) => v.write(w, tag, " xsi:type=\"afac:RateMatrix\"", ""),
Self::RateMatrixByReference(v) => v.write(w, tag, " xsi:type=\"afac:RateMatrixByReference\"", ""),
Self::RateTable(v) => v.write(w, tag, " xsi:type=\"afac:RateTable\"", ""),
Self::RateTableByReference(v) => v.write(w, tag, " xsi:type=\"afac:RateTableByReference\"", ""),
Self::UnknownRates(v) => v.write(w, tag, " xsi:type=\"afac:UnknownRates\"", ""),
Self::UnspecifiedRates(v) => v.write(w, tag, " xsi:type=\"afac:UnspecifiedRates\"", ""),
}
}
}
impl Rates {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
134 => if r.first(&mut seen)? { value = FreeOfCharge::read_json(r)?.map(|v| Self::FreeOfCharge(Box::new(v))); },
136 => if r.first(&mut seen)? { value = GeneralRateInformation::read_json(r)?.map(|v| Self::GeneralRateInformation(Box::new(v))); },
165 => if r.first(&mut seen)? { value = RateMatrix::read_json(r)?.map(|v| Self::RateMatrix(Box::new(v))); },
166 => if r.first(&mut seen)? { value = RateMatrixByReference::read_json(r)?.map(|v| Self::RateMatrixByReference(Box::new(v))); },
169 => if r.first(&mut seen)? { value = RateTable::read_json(r)?.map(|v| Self::RateTable(Box::new(v))); },
170 => if r.first(&mut seen)? { value = RateTableByReference::read_json(r)?.map(|v| Self::RateTableByReference(Box::new(v))); },
200 => if r.first(&mut seen)? { value = UnknownRates::read_json(r)?.map(|v| Self::UnknownRates(Box::new(v))); },
202 => if r.first(&mut seen)? { value = UnspecifiedRates::read_json(r)?.map(|v| Self::UnspecifiedRates(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Rates in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::FreeOfCharge(v) => {
if w.wrapper(134)? {
w.begin_object(118)?;
w.key(134)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::GeneralRateInformation(v) => {
if w.wrapper(136)? {
w.begin_object(118)?;
w.key(136)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RateMatrix(v) => {
if w.wrapper(165)? {
w.begin_object(118)?;
w.key(165)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RateMatrixByReference(v) => {
if w.wrapper(166)? {
w.begin_object(118)?;
w.key(166)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RateTable(v) => {
if w.wrapper(169)? {
w.begin_object(118)?;
w.key(169)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RateTableByReference(v) => {
if w.wrapper(170)? {
w.begin_object(118)?;
w.key(170)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnknownRates(v) => {
if w.wrapper(200)? {
w.begin_object(118)?;
w.key(200)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnspecifiedRates(v) => {
if w.wrapper(202)? {
w.begin_object(118)?;
w.key(202)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `afac:SupplementalFacility`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum SupplementalFacility {
/// XML type `aegi:ElectricChargingEquipment`.
ElectricChargingEquipment(Box<aegi::ElectricChargingEquipment>),
/// XML type `afac:SupplementalEquipment`.
SupplementalEquipment(Box<SupplementalEquipment>),
/// XML type `afac:SupplementalServiceFacility`.
SupplementalServiceFacility(Box<SupplementalServiceFacility>),
}
impl SupplementalFacility {
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(0x10093) => Self::ElectricChargingEquipment(Box::new(aegi::ElectricChargingEquipment::read(r)?)),
Some(0x2020b) => Self::SupplementalEquipment(Box::new(SupplementalEquipment::read(r)?)),
Some(0x2020e) => Self::SupplementalServiceFacility(Box::new(SupplementalServiceFacility::read(r)?)),
_ => {
r.unknown_type("SupplementalFacility")?;
return Ok(None);
}
}))
}
/// XML attribute `id`, which every kind has.
pub fn id(&self) -> Option<&str> {
match self {
Self::ElectricChargingEquipment(v) => v.id.as_deref(),
Self::SupplementalEquipment(v) => v.id.as_deref(),
Self::SupplementalServiceFacility(v) => v.id.as_deref(),
}
}
/// XML attribute `version`, which every kind has.
pub fn version(&self) -> Option<&str> {
match self {
Self::ElectricChargingEquipment(v) => v.version.as_deref(),
Self::SupplementalEquipment(v) => v.version.as_deref(),
Self::SupplementalServiceFacility(v) => v.version.as_deref(),
}
}
/// XML element `afac:name`, which every kind has.
pub fn name(&self) -> Option<&MultilingualString> {
match self {
Self::ElectricChargingEquipment(v) => v.name.as_ref(),
Self::SupplementalEquipment(v) => v.name.as_ref(),
Self::SupplementalServiceFacility(v) => v.name.as_ref(),
}
}
/// XML element `afac:alias`, which every kind has.
pub fn alias(&self) -> &[MultilingualString] {
match self {
Self::ElectricChargingEquipment(v) => &v.alias,
Self::SupplementalEquipment(v) => &v.alias,
Self::SupplementalServiceFacility(v) => &v.alias,
}
}
/// XML element `afac:lastUpdated`, which every kind has.
pub fn last_updated(&self) -> Option<&DateTime> {
match self {
Self::ElectricChargingEquipment(v) => v.last_updated.as_ref(),
Self::SupplementalEquipment(v) => v.last_updated.as_ref(),
Self::SupplementalServiceFacility(v) => v.last_updated.as_ref(),
}
}
/// XML element `afac:description`, which every kind has.
pub fn description(&self) -> Option<&MultilingualString> {
match self {
Self::ElectricChargingEquipment(v) => v.description.as_ref(),
Self::SupplementalEquipment(v) => v.description.as_ref(),
Self::SupplementalServiceFacility(v) => v.description.as_ref(),
}
}
/// XML element `afac:accessibility`, which every kind has.
pub fn accessibility(&self) -> &[AccessibilityEnum] {
match self {
Self::ElectricChargingEquipment(v) => &v.accessibility,
Self::SupplementalEquipment(v) => &v.accessibility,
Self::SupplementalServiceFacility(v) => &v.accessibility,
}
}
/// XML element `afac:additionalInformation`, which every kind has.
pub fn additional_information(&self) -> &[MultilingualString] {
match self {
Self::ElectricChargingEquipment(v) => &v.additional_information,
Self::SupplementalEquipment(v) => &v.additional_information,
Self::SupplementalServiceFacility(v) => &v.additional_information,
}
}
/// XML element `afac:externalIdentifier`, which every kind has.
pub fn external_identifier(&self) -> &[ExternalIdentifier] {
match self {
Self::ElectricChargingEquipment(v) => &v.external_identifier,
Self::SupplementalEquipment(v) => &v.external_identifier,
Self::SupplementalServiceFacility(v) => &v.external_identifier,
}
}
/// XML element `afac:informationWebsite`, which every kind has.
pub fn information_website(&self) -> &[com::UrlLink] {
match self {
Self::ElectricChargingEquipment(v) => &v.information_website,
Self::SupplementalEquipment(v) => &v.information_website,
Self::SupplementalServiceFacility(v) => &v.information_website,
}
}
/// XML element `afac:photoUrl`, which every kind has.
pub fn photo_url(&self) -> &[com::UrlLink] {
match self {
Self::ElectricChargingEquipment(v) => &v.photo_url,
Self::SupplementalEquipment(v) => &v.photo_url,
Self::SupplementalServiceFacility(v) => &v.photo_url,
}
}
/// XML element `afac:photo`, which every kind has.
pub fn photo(&self) -> &[Image] {
match self {
Self::ElectricChargingEquipment(v) => &v.photo,
Self::SupplementalEquipment(v) => &v.photo,
Self::SupplementalServiceFacility(v) => &v.photo,
}
}
/// XML element `afac:operatingHours`, which every kind has.
pub fn operating_hours(&self) -> Option<&OperatingHours> {
match self {
Self::ElectricChargingEquipment(v) => v.operating_hours.as_ref(),
Self::SupplementalEquipment(v) => v.operating_hours.as_ref(),
Self::SupplementalServiceFacility(v) => v.operating_hours.as_ref(),
}
}
/// XML element `afac:locationReference`, which every kind has.
pub fn location_reference(&self) -> Option<&loc::LocationReference> {
match self {
Self::ElectricChargingEquipment(v) => v.location_reference.as_ref(),
Self::SupplementalEquipment(v) => v.location_reference.as_ref(),
Self::SupplementalServiceFacility(v) => v.location_reference.as_ref(),
}
}
/// XML element `afac:owner`, which every kind has.
pub fn owner(&self) -> Option<&Organisation> {
match self {
Self::ElectricChargingEquipment(v) => v.owner.as_ref(),
Self::SupplementalEquipment(v) => v.owner.as_ref(),
Self::SupplementalServiceFacility(v) => v.owner.as_ref(),
}
}
/// XML element `afac:operator`, which every kind has.
pub fn operator(&self) -> Option<&Organisation> {
match self {
Self::ElectricChargingEquipment(v) => v.operator.as_ref(),
Self::SupplementalEquipment(v) => v.operator.as_ref(),
Self::SupplementalServiceFacility(v) => v.operator.as_ref(),
}
}
/// XML element `afac:helpdesk`, which every kind has.
pub fn helpdesk(&self) -> Option<&Organisation> {
match self {
Self::ElectricChargingEquipment(v) => v.helpdesk.as_ref(),
Self::SupplementalEquipment(v) => v.helpdesk.as_ref(),
Self::SupplementalServiceFacility(v) => v.helpdesk.as_ref(),
}
}
/// XML element `afac:associatedFacility`, which every kind has.
pub fn associated_facility(&self) -> &[AnyAssociatedFacility] {
match self {
Self::ElectricChargingEquipment(v) => &v.associated_facility,
Self::SupplementalEquipment(v) => &v.associated_facility,
Self::SupplementalServiceFacility(v) => &v.associated_facility,
}
}
/// XML element `afac:rates`, which every kind has.
pub fn rates(&self) -> Option<&Rates> {
match self {
Self::ElectricChargingEquipment(v) => v.rates.as_ref(),
Self::SupplementalEquipment(v) => v.rates.as_ref(),
Self::SupplementalServiceFacility(v) => v.rates.as_ref(),
}
}
/// XML element `afac:applicableForVehicles`, which every kind has.
pub fn applicable_for_vehicles(&self) -> &[com::VehicleCharacteristics] {
match self {
Self::ElectricChargingEquipment(v) => &v.applicable_for_vehicles,
Self::SupplementalEquipment(v) => &v.applicable_for_vehicles,
Self::SupplementalServiceFacility(v) => &v.applicable_for_vehicles,
}
}
/// XML element `afac:dimension`, which every kind has.
pub fn dimension(&self) -> Option<&Dimension> {
match self {
Self::ElectricChargingEquipment(v) => v.dimension.as_deref(),
Self::SupplementalEquipment(v) => v.dimension.as_deref(),
Self::SupplementalServiceFacility(v) => v.dimension.as_deref(),
}
}
/// XML element `afac:amenities`, which every kind has.
pub fn amenities(&self) -> Option<&Amenities> {
match self {
Self::ElectricChargingEquipment(v) => v.amenities.as_deref(),
Self::SupplementalEquipment(v) => v.amenities.as_deref(),
Self::SupplementalServiceFacility(v) => v.amenities.as_deref(),
}
}
/// XML element `afac:_facilityObjectExtension`, which every kind has.
pub fn facility_object_extension(&self) -> Option<&Extension> {
match self {
Self::ElectricChargingEquipment(v) => v.facility_object_extension.as_deref(),
Self::SupplementalEquipment(v) => v.facility_object_extension.as_deref(),
Self::SupplementalServiceFacility(v) => v.facility_object_extension.as_deref(),
}
}
/// XML element `afac:availability`, which every kind has.
pub fn availability(&self) -> Option<&AvailabilityEnum> {
match self {
Self::ElectricChargingEquipment(v) => v.availability.as_ref(),
Self::SupplementalEquipment(v) => v.availability.as_ref(),
Self::SupplementalServiceFacility(v) => v.availability.as_ref(),
}
}
/// XML element `afac:quantity`, which every kind has.
pub fn quantity(&self) -> Option<&com::NonNegativeInteger> {
match self {
Self::ElectricChargingEquipment(v) => v.quantity.as_ref(),
Self::SupplementalEquipment(v) => v.quantity.as_ref(),
Self::SupplementalServiceFacility(v) => v.quantity.as_ref(),
}
}
/// XML element `afac:regularlyCleaned`, which every kind has.
pub fn regularly_cleaned(&self) -> Option<&com::Boolean> {
match self {
Self::ElectricChargingEquipment(v) => v.regularly_cleaned.as_ref(),
Self::SupplementalEquipment(v) => v.regularly_cleaned.as_ref(),
Self::SupplementalServiceFacility(v) => v.regularly_cleaned.as_ref(),
}
}
/// XML element `afac:applicableForUser`, which every kind has.
pub fn applicable_for_user(&self) -> &[UserTypeEnum] {
match self {
Self::ElectricChargingEquipment(v) => &v.applicable_for_user,
Self::SupplementalEquipment(v) => &v.applicable_for_user,
Self::SupplementalServiceFacility(v) => &v.applicable_for_user,
}
}
/// XML element `afac:nearby`, which every kind has.
pub fn nearby(&self) -> Option<&com::Boolean> {
match self {
Self::ElectricChargingEquipment(v) => v.nearby.as_ref(),
Self::SupplementalEquipment(v) => v.nearby.as_ref(),
Self::SupplementalServiceFacility(v) => v.nearby.as_ref(),
}
}
/// XML element `afac:_supplementalFacilityExtension`, which every kind has.
pub fn supplemental_facility_extension(&self) -> Option<&Extension> {
match self {
Self::ElectricChargingEquipment(v) => v.supplemental_facility_extension.as_deref(),
Self::SupplementalEquipment(v) => v.supplemental_facility_extension.as_deref(),
Self::SupplementalServiceFacility(v) => v.supplemental_facility_extension.as_deref(),
}
}
}
impl SupplementalFacility {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::ElectricChargingEquipment(v) => v.write(w, tag, " xsi:type=\"aegi:ElectricChargingEquipment\"", ""),
Self::SupplementalEquipment(v) => v.write(w, tag, " xsi:type=\"afac:SupplementalEquipment\"", ""),
Self::SupplementalServiceFacility(v) => v.write(w, tag, " xsi:type=\"afac:SupplementalServiceFacility\"", ""),
}
}
}
impl SupplementalFacility {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
77 => if r.first(&mut seen)? { value = aegi::ElectricChargingEquipment::read_json(r)?.map(|v| Self::ElectricChargingEquipment(Box::new(v))); },
183 => if r.first(&mut seen)? { value = SupplementalEquipment::read_json(r)?.map(|v| Self::SupplementalEquipment(Box::new(v))); },
187 => if r.first(&mut seen)? { value = SupplementalServiceFacility::read_json(r)?.map(|v| Self::SupplementalServiceFacility(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of SupplementalFacility in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::ElectricChargingEquipment(v) => {
if w.wrapper(77)? {
w.begin_object(129)?;
w.key(77)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SupplementalEquipment(v) => {
if w.wrapper(183)? {
w.begin_object(129)?;
w.key(183)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SupplementalServiceFacility(v) => {
if w.wrapper(187)? {
w.begin_object(129)?;
w.key(187)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}