// @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/facilities`.
//!
//! 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, afir_facilities as afac, 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 `fac: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 `fac:AmountOfMoney`.
pub type AmountOfMoney = Decimal;
/// XML enumeration `fac: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 `fac: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 `fac:CurrencyCode`.
pub type CurrencyCode = String;
/// XML simple type `fac:Duration`.
pub type Duration = String;
/// XML enumeration `fac: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 `fac:EquipmentTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EquipmentTypeEnum {
/// `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,
/// `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::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::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 {
"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),
"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 `fac: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 `fac: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 simple type `fac:IndexReference`.
pub type IndexReference = com::Integer;
/// XML enumeration `fac: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,
/// `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::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),
"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 `fac: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 `fac: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 `fac: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 `fac: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 `fac:PaymentTimingEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PaymentTimingEnum {
/// `prepay`
Prepay,
/// `payOnEntry`
PayOnEntry,
/// `payPriorToExit`
PayPriorToExit,
/// `payAfterExit`
PayAfterExit,
/// `payAndExit`
PayAndExit,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl PaymentTimingEnum {
/// 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 PaymentTimingEnum {
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 PaymentTimingEnum {
/// 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 `fac: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 `fac: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 `fac: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 `fac:RateUsageConditionsTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RateUsageConditionsTypeEnum {
/// `fixedDuration`
FixedDuration,
/// `fixedNumber`
FixedNumber,
/// `once`
Once,
/// `unlimited`
Unlimited,
/// A value outside the standard list.
Extended(String),
}
impl RateUsageConditionsTypeEnum {
/// 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 RateUsageConditionsTypeEnum {
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 RateUsageConditionsTypeEnum {
/// 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 `fac: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 `fac: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 `fac: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 `fac:ServiceFacilityTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ServiceFacilityTypeEnum {
/// `bikeGarage`
BikeGarage,
/// `bikeSharing`
BikeSharing,
/// `cafe`
Cafe,
/// `carWash`
CarWash,
/// `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::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),
"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 `fac:SquareMetres`.
pub type SquareMetres = com::NonNegativeInteger;
/// XML enumeration `fac: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 `fac:TimeZone`.
pub type TimeZone = String;
/// XML enumeration `fac: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,
/// `pregnantWomen`
PregnantWomen,
/// `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::PregnantWomen => "pregnantWomen",
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),
"pregnantWomen" => Some(Self::PregnantWomen),
"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 `fac:AmountInCurrency`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AmountInCurrency {
/// XML element `fac:currencyValue`.
pub currency_value: Option<AmountOfMoney>,
/// XML element `fac:currencyType`.
pub currency_type: Option<CurrencyCode>,
/// XML element `fac:_amountInCurrencyExtension`.
pub amount_in_currency_extension: Option<Box<Extension>>,
}
impl AmountInCurrency {
const FIELDS: &'static [u32] = &[0xa0780, 0xa077f, 0xa0438];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0031);
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 {
0xa0780 => { let v = r.value::<Decimal>()?; r.set(&mut e0, v, 1920); }
0xa077f => { let v = r.string()?; r.set(&mut e1, v, 1919); }
0xa0438 => { 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("fac:currencyValue", v)?; }
None => return Err(w.missing("fac:currencyValue")),
}
match &self.currency_type {
Some(v) => { w.max_len("currencyType", v, 1024)?; w.pattern("currencyType", v, Pattern::CurrencyCode)?; w.leaf("fac:currencyType", v)?; }
None => return Err(w.missing("fac:currencyType")),
}
if let Some(v) = &self.amount_in_currency_extension { w.extension("fac:_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()?; },
746 => 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(357)?;
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(746)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:AssociatedFacility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AssociatedFacility {
/// XML element `fac:type`.
pub r#type: Option<FacilityTypeEnum>,
/// XML element `fac:facilityReference`.
pub facility_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:_associatedFacilityExtension`.
pub associated_facility_extension: Option<Box<Extension>>,
}
impl AssociatedFacility {
const FIELDS: &'static [u32] = &[0xa0c5d, 0xa0848, 0xa07a8, 0xa0440];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0039);
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 {
0xa0c5d => { let v = r.enumeration::<FacilityTypeEnum>()?; r.set(&mut e0, v, 3165); }
0xa0848 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e1, v.map(Box::new), 2120); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e2, v, 1960); }
0xa0440 => { 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("fac:type", v.literal())?; }
None => return Err(w.missing("fac:type")),
}
if let Some(v) = &self.facility_reference { v.write(w, "fac:facilityReference", "", " targetClass=\"fac:FacilityObject\"")?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
if let Some(v) = &self.associated_facility_extension { w.extension("fac:_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()?; },
748 => 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(358)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.r#type {
Some(v) => {
w.key(2495)?;
w.enumeration(378, 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(748)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:BrandsAcceptedCodeList`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct BrandsAcceptedCodeList {
/// XML element `fac:brandsAcceptedList`.
pub brands_accepted_list: Option<PaymentBrandsEnum>,
/// XML element `fac:_brandsAcceptedCodeListExtension`.
pub brands_accepted_code_list_extension: Option<Box<Extension>>,
}
impl BrandsAcceptedCodeList {
const FIELDS: &'static [u32] = &[0xa0729, 0xa044a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0043);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0729 => { let v = r.enumeration::<PaymentBrandsEnum>()?; r.set(&mut e0, v, 1833); }
0xa044a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1098); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1833);
let v = Self {
brands_accepted_list: e0,
brands_accepted_code_list_extension: e1,
};
r.close();
Ok(v)
}
}
impl BrandsAcceptedCodeList {
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.brands_accepted_list {
Some(v) => { w.enumeration("fac:brandsAcceptedList", v.literal())?; }
None => return Err(w.missing("fac:brandsAcceptedList")),
}
if let Some(v) = &self.brands_accepted_code_list_extension { w.extension("fac:_brandsAcceptedCodeListExtension", v)?; }
w.end(tag)
}
}
impl BrandsAcceptedCodeList {
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 {
308 => if r.first(&mut seen[0])? { f0 = r.enumeration::<PaymentBrandsEnum>()?; },
749 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 308);
Ok(Self {
brands_accepted_list: f0,
brands_accepted_code_list_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(361)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.brands_accepted_list {
Some(v) => {
w.key(308)?;
w.enumeration(399, v.literal())?;
}
None => w.absent(308, w.missing("brandsAcceptedList"))?,
}
if let Some(v) = &self.brands_accepted_code_list_extension {
w.key(749)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:BrandsAcceptedText`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct BrandsAcceptedText {
/// XML element `fac:brandsAccepted`.
pub brands_accepted: Option<String>,
/// XML element `fac:_brandsAcceptedTextExtension`.
pub brands_accepted_text_extension: Option<Box<Extension>>,
}
impl BrandsAcceptedText {
const FIELDS: &'static [u32] = &[0xa0727, 0xa044b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0044);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0727 => { let v = r.string()?; r.set(&mut e0, v, 1831); }
0xa044b => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1099); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1831);
let v = Self {
brands_accepted: e0,
brands_accepted_text_extension: e1,
};
r.close();
Ok(v)
}
}
impl BrandsAcceptedText {
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.brands_accepted {
Some(v) => { w.max_len("brandsAccepted", v, 1024)?; w.leaf("fac:brandsAccepted", v)?; }
None => return Err(w.missing("fac:brandsAccepted")),
}
if let Some(v) = &self.brands_accepted_text_extension { w.extension("fac:_brandsAcceptedTextExtension", v)?; }
w.end(tag)
}
}
impl BrandsAcceptedText {
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 {
306 => if r.first(&mut seen[0])? { f0 = r.string()?; },
750 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 306);
Ok(Self {
brands_accepted: f0,
brands_accepted_text_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(362)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.brands_accepted {
Some(v) => {
w.key(306)?;
w.max_len("brandsAccepted", v, 1024)?; w.string(v)?;
}
None => w.absent(306, w.missing("brandsAccepted"))?,
}
if let Some(v) = &self.brands_accepted_text_extension {
w.key(750)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:ClosureInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ClosureInformation {
/// XML element `fac:permananentlyClosed`.
pub permananently_closed: Option<com::Boolean>,
/// XML element `fac:temporarilyClosed`.
pub temporarily_closed: Option<com::Boolean>,
/// XML element `fac:closedFrom`.
pub closed_from: Option<DateTime>,
/// XML element `fac:temporarilyClosedUntil`.
pub temporarily_closed_until: Option<DateTime>,
/// XML element `fac:_closureInformationExtension`.
pub closure_information_extension: Option<Box<Extension>>,
}
impl ClosureInformation {
const FIELDS: &'static [u32] = &[0xa0a66, 0xa0c06, 0xa0749, 0xa0c07, 0xa0457];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0051);
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 {
0xa0a66 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2662); }
0xa0c06 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 3078); }
0xa0749 => { let v = r.date_time()?; r.set(&mut e2, v, 1865); }
0xa0c07 => { let v = r.date_time()?; r.set(&mut e3, v, 3079); }
0xa0457 => { 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("fac:permananentlyClosed", v)?; }
if let Some(v) = &self.temporarily_closed { w.leaf("fac:temporarilyClosed", v)?; }
if let Some(v) = &self.closed_from { w.leaf("fac:closedFrom", v)?; }
if let Some(v) = &self.temporarily_closed_until { w.leaf("fac:temporarilyClosedUntil", v)?; }
if let Some(v) = &self.closure_information_extension { w.extension("fac:_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()?; },
751 => 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(363)?;
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(751)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:ContactInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ContactInformation {
/// XML element `fac:language`.
pub language: Vec<com::Language>,
/// XML element `fac:telephoneNumber`.
pub telephone_number: Option<String>,
/// XML element `fac:faxNumber`.
pub fax_number: Option<String>,
/// XML element `fac:eMail`.
pub e_mail: Option<String>,
/// XML element `fac:_contactInformationExtension`.
pub contact_information_extension: Option<Box<Extension>>,
}
impl ContactInformation {
const FIELDS: &'static [u32] = &[0xa08ee, 0xa0c03, 0xa0858, 0xa07e4, 0xa0464];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa005e);
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 {
0xa08ee => { let v = r.string()?; e0.extend(v); }
0xa0c03 => { let v = r.string()?; r.set(&mut e1, v, 3075); }
0xa0858 => { let v = r.string()?; r.set(&mut e2, v, 2136); }
0xa07e4 => { let v = r.string()?; r.set(&mut e3, v, 2020); }
0xa0464 => { 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("fac:language", v)?; }
if let Some(v) = &self.telephone_number { w.max_len("telephoneNumber", v, 1024)?; w.leaf("fac:telephoneNumber", v)?; }
if let Some(v) = &self.fax_number { w.max_len("faxNumber", v, 1024)?; w.leaf("fac:faxNumber", v)?; }
if let Some(v) = &self.e_mail { w.max_len("eMail", v, 1024)?; w.leaf("fac:eMail", v)?; }
if let Some(v) = &self.contact_information_extension { w.extension("fac:_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()?; },
753 => 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(364)?;
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(753)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:ContactPerson`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ContactPerson {
/// XML element `fac:language`.
pub language: Vec<com::Language>,
/// XML element `fac:telephoneNumber`.
pub telephone_number: Option<String>,
/// XML element `fac:faxNumber`.
pub fax_number: Option<String>,
/// XML element `fac:eMail`.
pub e_mail: Option<String>,
/// XML element `fac:_contactInformationExtension`.
pub contact_information_extension: Option<Box<Extension>>,
/// XML element `fac:name`.
pub name: Option<String>,
/// XML element `fac:firstName`.
pub first_name: Option<String>,
/// XML element `fac:title`.
pub title: Option<MultilingualString>,
/// XML element `fac:position`.
pub position: Option<MultilingualString>,
/// XML element `fac:_contactPersonExtension`.
pub contact_person_extension: Option<Box<Extension>>,
}
impl ContactPerson {
const FIELDS: &'static [u32] = &[0xa08ee, 0xa0c03, 0xa0858, 0xa07e4, 0xa0464, 0xa098b, 0xa085e, 0xa0c1e, 0xa0a94, 0xa0465];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa005f);
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 {
0xa08ee => { let v = r.string()?; e0.extend(v); }
0xa0c03 => { let v = r.string()?; r.set(&mut e1, v, 3075); }
0xa0858 => { let v = r.string()?; r.set(&mut e2, v, 2136); }
0xa07e4 => { let v = r.string()?; r.set(&mut e3, v, 2020); }
0xa0464 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1124); }
0xa098b => { let v = r.string()?; r.set(&mut e5, v, 2443); }
0xa085e => { let v = r.string()?; r.set(&mut e6, v, 2142); }
0xa0c1e => { let v = r.multilingual()?; r.set(&mut e7, v, 3102); }
0xa0a94 => { let v = r.multilingual()?; r.set(&mut e8, v, 2708); }
0xa0465 => { 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("fac:language", v)?; }
if let Some(v) = &self.telephone_number { w.max_len("telephoneNumber", v, 1024)?; w.leaf("fac:telephoneNumber", v)?; }
if let Some(v) = &self.fax_number { w.max_len("faxNumber", v, 1024)?; w.leaf("fac:faxNumber", v)?; }
if let Some(v) = &self.e_mail { w.max_len("eMail", v, 1024)?; w.leaf("fac:eMail", v)?; }
if let Some(v) = &self.contact_information_extension { w.extension("fac:_contactInformationExtension", v)?; }
match &self.name {
Some(v) => { w.max_len("name", v, 1024)?; w.leaf("fac:name", v)?; }
None => return Err(w.missing("fac:name")),
}
if let Some(v) = &self.first_name { w.max_len("firstName", v, 1024)?; w.leaf("fac:firstName", v)?; }
if let Some(v) = &self.title { w.multilingual("fac:title", v)?; }
if let Some(v) = &self.position { w.multilingual("fac:position", v)?; }
if let Some(v) = &self.contact_person_extension { w.extension("fac:_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()?; },
753 => 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()?; },
755 => 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(366)?;
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(753)?;
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(755)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:Credential`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Credential {
/// XML element `fac:type`.
pub r#type: Option<CredentialTypeEnum>,
/// XML element `fac:otherType`.
pub other_type: Option<String>,
/// XML element `fac:_credentialExtension`.
pub credential_extension: Option<Box<Extension>>,
}
impl Credential {
const FIELDS: &'static [u32] = &[0xa0c5d, 0xa0a32, 0xa046d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0066);
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 {
0xa0c5d => { let v = r.enumeration::<CredentialTypeEnum>()?; r.set(&mut e0, v, 3165); }
0xa0a32 => { let v = r.string()?; r.set(&mut e1, v, 2610); }
0xa046d => { 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("fac:type", v.literal())?; }
None => return Err(w.missing("fac:type")),
}
if let Some(v) = &self.other_type { w.max_len("otherType", v, 1024)?; w.leaf("fac:otherType", v)?; }
if let Some(v) = &self.credential_extension { w.extension("fac:_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()?; },
759 => 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(367)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.r#type {
Some(v) => {
w.key(2495)?;
w.enumeration(370, 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(759)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:CredentialAssigned`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct CredentialAssigned {
/// XML element `fac:type`.
pub r#type: Option<CredentialTypeEnum>,
/// XML element `fac:otherType`.
pub other_type: Option<String>,
/// XML element `fac:_credentialExtension`.
pub credential_extension: Option<Box<Extension>>,
/// XML element `fac:localIdentifier`.
pub local_identifier: Option<String>,
/// XML element `fac:issuer`.
pub issuer: Option<Box<com::VersionedReference>>,
/// XML element `fac:_credentialAssignedExtension`.
pub credential_assigned_extension: Option<Box<Extension>>,
}
impl CredentialAssigned {
const FIELDS: &'static [u32] = &[0xa0c5d, 0xa0a32, 0xa046d, 0xa0919, 0xa08dc, 0xa046c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0067);
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 {
0xa0c5d => { let v = r.enumeration::<CredentialTypeEnum>()?; r.set(&mut e0, v, 3165); }
0xa0a32 => { let v = r.string()?; r.set(&mut e1, v, 2610); }
0xa046d => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1133); }
0xa0919 => { let v = r.string()?; r.set(&mut e3, v, 2329); }
0xa08dc => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 2268); }
0xa046c => { 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("fac:type", v.literal())?; }
None => return Err(w.missing("fac:type")),
}
if let Some(v) = &self.other_type { w.max_len("otherType", v, 1024)?; w.leaf("fac:otherType", v)?; }
if let Some(v) = &self.credential_extension { w.extension("fac:_credentialExtension", v)?; }
if let Some(v) = &self.local_identifier { w.max_len("localIdentifier", v, 1024)?; w.leaf("fac:localIdentifier", v)?; }
match &self.issuer {
Some(v) => { v.write(w, "fac:issuer", "", " targetClass=\"fac:Organisation\"")?; }
None => return Err(w.missing("fac:issuer")),
}
if let Some(v) = &self.credential_assigned_extension { w.extension("fac:_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()?; },
759 => 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); },
758 => 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(368)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.r#type {
Some(v) => {
w.key(2495)?;
w.enumeration(370, 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(759)?;
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(758)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:Dimension`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Dimension {
/// XML element `fac:length`.
pub length: Option<com::MetresAsFloat>,
/// XML element `fac:width`.
pub width: Option<com::MetresAsFloat>,
/// XML element `fac:height`.
pub height: Option<com::MetresAsFloat>,
/// XML element `fac:usableArea`.
pub usable_area: Option<SquareMetres>,
/// XML element `fac:_dimensionExtension`.
pub dimension_extension: Option<Box<Extension>>,
}
impl Dimension {
const FIELDS: &'static [u32] = &[0xa0903, 0xa0cd7, 0xa0897, 0xa0c75, 0xa0484];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa007f);
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 {
0xa0903 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2307); }
0xa0cd7 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3287); }
0xa0897 => { let v = r.value::<f32>()?; r.set(&mut e2, v, 2199); }
0xa0c75 => { let v = r.value::<u64>()?; r.set(&mut e3, v, 3189); }
0xa0484 => { 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("fac:length", v)?; }
if let Some(v) = &self.width { w.leaf("fac:width", v)?; }
if let Some(v) = &self.height { w.leaf("fac:height", v)?; }
if let Some(v) = &self.usable_area { w.leaf("fac:usableArea", v)?; }
if let Some(v) = &self.dimension_extension { w.extension("fac:_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>()?; },
760 => 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(371)?;
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(760)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:duration`.
pub duration: Option<com::Seconds>,
/// XML element `fac:_durationValueExtension`.
pub duration_value_extension: Option<Box<Extension>>,
}
impl DurationValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0xa07db, 0xa0491];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa008c);
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); }
0xa07db => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2011); }
0xa0491 => { 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("fac:duration", v)?; }
None => return Err(w.missing("fac:duration")),
}
if let Some(v) = &self.duration_value_extension { w.extension("fac:_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>()?; },
761 => 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(372)?;
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(761)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:Eligibility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Eligibility {
/// XML element `fac:eligibilityName`.
pub eligibility_name: Option<MultilingualString>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:qualification`.
pub qualification: Vec<Qualification>,
/// XML element `fac:_eligibilityExtension`.
pub eligibility_extension: Option<Box<Extension>>,
}
impl Eligibility {
const FIELDS: &'static [u32] = &[0xa07f3, 0xa07a8, 0xa0add, 0xa049f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa009a);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa07f3 => { let v = r.multilingual()?; r.set(&mut e0, v, 2035); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e1, v, 1960); }
0xa0add => { let v = Some(Qualification::read(r)?); e2.extend(v); }
0xa049f => { let v = r.raw()?; r.set(&mut e3, 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 {
eligibility_name: e0,
description: e1,
qualification: e2,
eligibility_extension: e3,
};
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.eligibility_name { w.multilingual("fac:eligibilityName", v)?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
for v in &self.qualification { v.write(w, "fac:qualification", "", "")?; }
if let Some(v) = &self.eligibility_extension { w.extension("fac:_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; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
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 {
655 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
545 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
1781 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Qualification::read_json(r)? { f2.push(v); } } },
762 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
eligibility_name: f0,
description: f1,
qualification: f2,
eligibility_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(373)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.eligibility_name {
w.key(655)?;
w.multilingual(v)?;
}
if let Some(v) = &self.description {
w.key(545)?;
w.multilingual(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.eligibility_extension {
w.key(762)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:FacilityObjectStatus`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FacilityObjectStatus {
/// XML element `fac:reference`.
pub reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:openingStatus`.
pub opening_status: Option<OpeningStatusEnum>,
/// XML element `fac:regularOperatingHoursInForce`.
pub regular_operating_hours_in_force: Option<com::Boolean>,
/// XML element `fac:statusDescription`.
pub status_description: Option<MultilingualString>,
/// XML element `fac:newOperatingHours`.
pub new_operating_hours: Option<OperatingHours>,
/// XML element `fac:newRates`.
pub new_rates: Option<Rates>,
/// XML element `fac:fault`.
pub fault: Option<com::AnyFault>,
/// XML element `fac:_facilityObjectStatusExtension`.
pub facility_object_status_extension: Option<Box<Extension>>,
}
impl FacilityObjectStatus {
const FIELDS: &'static [u32] = &[0xa0b01, 0xa08f8, 0xa09ec, 0xa0b13, 0xa0bd2, 0xa099a, 0xa099b, 0xa0849, 0xa04b8];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa00b4);
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0b01 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2817); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e1, v, 2296); }
0xa09ec => { let v = r.enumeration::<OpeningStatusEnum>()?; r.set(&mut e2, v, 2540); }
0xa0b13 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2835); }
0xa0bd2 => { let v = r.multilingual()?; r.set(&mut e4, v, 3026); }
0xa099a => { let v = OperatingHours::read(r)?; r.set(&mut e5, v, 2458); }
0xa099b => { let v = Rates::read(r)?; r.set(&mut e6, v, 2459); }
0xa0849 => { let v = com::AnyFault::read(r)?; r.set(&mut e7, v, 2121); }
0xa04b8 => { let v = r.raw()?; r.set(&mut e8, 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,
regular_operating_hours_in_force: e3,
status_description: e4,
new_operating_hours: e5,
new_rates: e6,
fault: e7,
facility_object_status_extension: e8,
};
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, "fac:reference", "", " targetClass=\"fac:FacilityObject\"")?; }
None => return Err(w.missing("fac:reference")),
}
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.opening_status { w.enumeration("fac:openingStatus", v.literal())?; }
if let Some(v) = &self.regular_operating_hours_in_force { w.leaf("fac:regularOperatingHoursInForce", v)?; }
if let Some(v) = &self.status_description { w.multilingual("fac:statusDescription", v)?; }
if let Some(v) = &self.new_operating_hours { v.write(w, "fac:newOperatingHours")?; }
if let Some(v) = &self.new_rates { v.write(w, "fac:newRates")?; }
if let Some(v) = &self.fault { v.write(w, "fac:fault")?; }
if let Some(v) = &self.facility_object_status_extension { w.extension("fac:_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; 9];
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;
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>()?; },
1835 => if r.first(&mut seen[3])? { f3 = r.boolean()?; },
2191 => if r.first(&mut seen[4])? { f4 = r.multilingual()?; },
1358 => if r.first(&mut seen[5])? { f5 = OperatingHours::read_json(r)?; },
1359 => if r.first(&mut seen[6])? { f6 = Rates::read_json(r)?; },
831 => if r.first(&mut seen[7])? { f7 = com::AnyFault::read_json(r)?; },
765 => if r.first(&mut seen[8])? { f8 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1817);
Ok(Self {
reference: f0,
last_updated: f1,
opening_status: f2,
regular_operating_hours_in_force: f3,
status_description: f4,
new_operating_hours: f5,
new_rates: f6,
fault: f7,
facility_object_status_extension: f8,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(376)?;
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(385, 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(765)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:FacilityStatus`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FacilityStatus {
/// XML element `fac:reference`.
pub reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:openingStatus`.
pub opening_status: Option<OpeningStatusEnum>,
/// XML element `fac:regularOperatingHoursInForce`.
pub regular_operating_hours_in_force: Option<com::Boolean>,
/// XML element `fac:statusDescription`.
pub status_description: Option<MultilingualString>,
/// XML element `fac:newOperatingHours`.
pub new_operating_hours: Option<OperatingHours>,
/// XML element `fac:newRates`.
pub new_rates: Option<Rates>,
/// XML element `fac:fault`.
pub fault: Option<com::AnyFault>,
/// XML element `fac:_facilityObjectStatusExtension`.
pub facility_object_status_extension: Option<Box<Extension>>,
/// XML element `fac:supplementalFacilityStatus`.
pub supplemental_facility_status: Vec<SupplementalFacilityStatus>,
/// XML element `fac:_facilityStatusExtension`.
pub facility_status_extension: Option<Box<Extension>>,
}
impl FacilityStatus {
const FIELDS: &'static [u32] = &[0xa0b01, 0xa08f8, 0xa09ec, 0xa0b13, 0xa0bd2, 0xa099a, 0xa099b, 0xa0849, 0xa04b8, 0xa0bef, 0xa04b9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa00b5);
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 = Vec::new();
let mut e10 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0b01 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2817); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e1, v, 2296); }
0xa09ec => { let v = r.enumeration::<OpeningStatusEnum>()?; r.set(&mut e2, v, 2540); }
0xa0b13 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2835); }
0xa0bd2 => { let v = r.multilingual()?; r.set(&mut e4, v, 3026); }
0xa099a => { let v = OperatingHours::read(r)?; r.set(&mut e5, v, 2458); }
0xa099b => { let v = Rates::read(r)?; r.set(&mut e6, v, 2459); }
0xa0849 => { let v = com::AnyFault::read(r)?; r.set(&mut e7, v, 2121); }
0xa04b8 => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1208); }
0xa0bef => { let v = Some(SupplementalFacilityStatus::read(r)?); e9.extend(v); }
0xa04b9 => { let v = r.raw()?; r.set(&mut e10, 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,
regular_operating_hours_in_force: e3,
status_description: e4,
new_operating_hours: e5,
new_rates: e6,
fault: e7,
facility_object_status_extension: e8,
supplemental_facility_status: e9,
facility_status_extension: e10,
};
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, "fac:reference", "", " targetClass=\"fac:FacilityObject\"")?; }
None => return Err(w.missing("fac:reference")),
}
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.opening_status { w.enumeration("fac:openingStatus", v.literal())?; }
if let Some(v) = &self.regular_operating_hours_in_force { w.leaf("fac:regularOperatingHoursInForce", v)?; }
if let Some(v) = &self.status_description { w.multilingual("fac:statusDescription", v)?; }
if let Some(v) = &self.new_operating_hours { v.write(w, "fac:newOperatingHours")?; }
if let Some(v) = &self.new_rates { v.write(w, "fac:newRates")?; }
if let Some(v) = &self.fault { v.write(w, "fac:fault")?; }
if let Some(v) = &self.facility_object_status_extension { w.extension("fac:_facilityObjectStatusExtension", v)?; }
for v in &self.supplemental_facility_status { v.write(w, "fac:supplementalFacilityStatus", "", "")?; }
if let Some(v) = &self.facility_status_extension { w.extension("fac:_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; 11];
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 = Vec::new();
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 {
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>()?; },
1835 => if r.first(&mut seen[3])? { f3 = r.boolean()?; },
2191 => if r.first(&mut seen[4])? { f4 = r.multilingual()?; },
1358 => if r.first(&mut seen[5])? { f5 = OperatingHours::read_json(r)?; },
1359 => if r.first(&mut seen[6])? { f6 = Rates::read_json(r)?; },
831 => if r.first(&mut seen[7])? { f7 = com::AnyFault::read_json(r)?; },
765 => if r.first(&mut seen[8])? { f8 = r.raw_object()?.map(Box::new); },
2219 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = SupplementalFacilityStatus::read_json(r)? { f9.push(v); } } },
766 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1817);
Ok(Self {
reference: f0,
last_updated: f1,
opening_status: f2,
regular_operating_hours_in_force: f3,
status_description: f4,
new_operating_hours: f5,
new_rates: f6,
fault: f7,
facility_object_status_extension: f8,
supplemental_facility_status: f9,
facility_status_extension: f10,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(377)?;
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(385, 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(765)?;
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(766)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:FreeOfCharge`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FreeOfCharge {
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `fac:paymentMethod`.
pub payment_method: Option<Box<PaymentMethod>>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:energyPricingPolicy`.
pub energy_pricing_policy: Option<Box<egi::EnergyPricingPolicy>>,
/// XML element `fac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `fac:_freeOfChargeExtension`.
pub free_of_charge_extension: Option<Box<Extension>>,
}
impl FreeOfCharge {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0a59, 0xa0a36, 0xa0809, 0xa05b0, 0xa04be];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa00ba);
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 {
0xa06e8 => { let v = r.string()?; e0.extend(v); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); r.set(&mut e1, v.map(Box::new), 2649); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0xa0809 => { let v = Some(egi::EnergyPricingPolicy::read(r)?); r.set(&mut e3, v.map(Box::new), 2057); }
0xa05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xa04be => { let v = r.raw()?; r.set(&mut e5, 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_method: e1,
overall_period: e2,
energy_pricing_policy: e3,
rates_extension: e4,
free_of_charge_extension: e5,
};
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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "fac:overallPeriod", "", "")?; }
if let Some(v) = &self.energy_pricing_policy { v.write(w, "fac:energyPricingPolicy", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("fac:_ratesExtension", v)?; }
if let Some(v) = &self.free_of_charge_extension { w.extension("fac:_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; 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); } } },
1548 => if r.first(&mut seen[1])? { f1 = PaymentMethod::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
676 => if r.first(&mut seen[3])? { f3 = egi::EnergyPricingPolicy::read_json(r)?.map(Box::new); },
804 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
768 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment_method: f1,
overall_period: f2,
energy_pricing_policy: f3,
rates_extension: f4,
free_of_charge_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(379)?;
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_method {
w.key(1548)?;
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.energy_pricing_policy {
w.key(676)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(804)?;
w.extension(v)?;
}
if let Some(v) = &self.free_of_charge_extension {
w.key(768)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:GeneralRateInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GeneralRateInformation {
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `fac:paymentMethod`.
pub payment_method: Option<Box<PaymentMethod>>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:energyPricingPolicy`.
pub energy_pricing_policy: Option<Box<egi::EnergyPricingPolicy>>,
/// XML element `fac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `fac:_generalRateInformationExtension`.
pub general_rate_information_extension: Option<Box<Extension>>,
}
impl GeneralRateInformation {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0a59, 0xa0a36, 0xa0809, 0xa05b0, 0xa04cb];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa00c7);
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 {
0xa06e8 => { let v = r.string()?; e0.extend(v); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); r.set(&mut e1, v.map(Box::new), 2649); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0xa0809 => { let v = Some(egi::EnergyPricingPolicy::read(r)?); r.set(&mut e3, v.map(Box::new), 2057); }
0xa05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xa04cb => { let v = r.raw()?; r.set(&mut e5, 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_method: e1,
overall_period: e2,
energy_pricing_policy: e3,
rates_extension: e4,
general_rate_information_extension: e5,
};
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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "fac:overallPeriod", "", "")?; }
if let Some(v) = &self.energy_pricing_policy { v.write(w, "fac:energyPricingPolicy", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("fac:_ratesExtension", v)?; }
if let Some(v) = &self.general_rate_information_extension { w.extension("fac:_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; 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); } } },
1548 => if r.first(&mut seen[1])? { f1 = PaymentMethod::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
676 => if r.first(&mut seen[3])? { f3 = egi::EnergyPricingPolicy::read_json(r)?.map(Box::new); },
804 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
770 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment_method: f1,
overall_period: f2,
energy_pricing_policy: f3,
rates_extension: f4,
general_rate_information_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(380)?;
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_method {
w.key(1548)?;
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.energy_pricing_policy {
w.key(676)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(804)?;
w.extension(v)?;
}
if let Some(v) = &self.general_rate_information_extension {
w.key(770)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:Image`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Image {
/// XML element `fac:imageData`.
pub image_data: Option<com::Base64Binary>,
/// XML element `fac:imageFormat`.
pub image_format: Option<ImageFormatEnum>,
/// XML element `fac:_imageExtension`.
pub image_extension: Option<Box<Extension>>,
}
impl Image {
const FIELDS: &'static [u32] = &[0xa08b2, 0xa08b3, 0xa04e5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa00e0);
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 {
0xa08b2 => { let v = r.base64()?; r.set(&mut e0, v, 2226); }
0xa08b3 => { let v = r.enumeration::<ImageFormatEnum>()?; r.set(&mut e1, v, 2227); }
0xa04e5 => { 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("fac:imageData", v)?; }
None => return Err(w.missing("fac:imageData")),
}
match &self.image_format {
Some(v) => { w.enumeration("fac:imageFormat", v.literal())?; }
None => return Err(w.missing("fac:imageFormat")),
}
if let Some(v) = &self.image_extension { w.extension("fac:_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>()?; },
771 => 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(381)?;
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(382, v.literal())?;
}
None => w.absent(972, w.missing("imageFormat"))?,
}
if let Some(v) = &self.image_extension {
w.key(771)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:OpenAllHours`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenAllHours {
/// XML element `fac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `fac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `fac:_openAllHoursExtension`.
pub open_all_hours_extension: Option<Box<Extension>>,
}
impl OpenAllHours {
const FIELDS: &'static [u32] = &[0xa074a, 0xa054d, 0xa0536];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0137);
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 {
0xa074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0xa054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0xa0536 => { 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, "fac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("fac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.open_all_hours_extension { w.extension("fac:_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); },
776 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
773 => 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(384)?;
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(776)?;
w.extension(v)?;
}
if let Some(v) = &self.open_all_hours_extension {
w.key(773)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:OperatingHoursByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OperatingHoursByReference {
/// XML element `fac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `fac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `fac:operatingHoursReference`.
pub operating_hours_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:operatingHoursTableReference`.
pub operating_hours_table_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:_operatingHoursByReferenceExtension`.
pub operating_hours_by_reference_extension: Option<Box<Extension>>,
}
impl OperatingHoursByReference {
const FIELDS: &'static [u32] = &[0xa074a, 0xa054d, 0xa0a0a, 0xa0a0d, 0xa054c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa014e);
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 {
0xa074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0xa054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0xa0a0a => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e2, v.map(Box::new), 2570); }
0xa0a0d => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e3, v.map(Box::new), 2573); }
0xa054c => { 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, "fac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("fac:_operatingHoursExtension", v)?; }
match &self.operating_hours_reference {
Some(v) => { v.write(w, "fac:operatingHoursReference", "", " targetClass=\"fac:OperatingHoursSpecification\"")?; }
None => return Err(w.missing("fac:operatingHoursReference")),
}
if let Some(v) = &self.operating_hours_table_reference { v.write(w, "fac:operatingHoursTableReference", "", " targetClass=\"fac:OperatingHoursTable\"")?; }
if let Some(v) = &self.operating_hours_by_reference_extension { w.extension("fac:_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); },
776 => 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); },
775 => 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(386)?;
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(776)?;
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(775)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `fac:operatingHoursTable`.
pub operating_hours_table: Vec<OperatingHoursTable>,
/// XML element `fac:_operatingHoursPublicationExtension`.
pub operating_hours_publication_extension: Option<Box<Extension>>,
}
impl OperatingHoursPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0xa0893, 0xa0a0c, 0xa054e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa014f);
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); }
0xa0893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0xa0a0c => { let v = Some(OperatingHoursTable::read(r)?); e6.extend(v); }
0xa054e => { 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, "fac:headerInformation", "", "")?; }
w.count("fac:operatingHoursTable", self.operating_hours_table.len(), 1, usize::MAX)?;
for v in &self.operating_hours_table { v.write(w, "fac:operatingHoursTable", "", "")?; }
if let Some(v) = &self.operating_hours_publication_extension { w.extension("fac:_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); } } },
778 => 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(388)?;
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(778)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `fac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:label`.
pub label: Option<String>,
/// XML element `fac:operatingAllYear`.
pub operating_all_year: Option<com::Boolean>,
/// XML element `fac:urlLinkAddress`.
pub url_link_address: Option<com::Url>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:_operatingHoursSpecificationExtension`.
pub operating_hours_specification_extension: Option<Box<Extension>>,
}
impl OperatingHoursSpecification {
const FIELDS: &'static [u32] = &[0xa074a, 0xa054d, 0xa08f8, 0xa08e7, 0xa0a08, 0xa0c71, 0xa0a36, 0xa054f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0150);
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 {
0xa074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0xa054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0xa08e7 => { let v = r.string()?; r.set(&mut e3, v, 2279); }
0xa0a08 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2568); }
0xa0c71 => { let v = r.string()?; r.set(&mut e5, v, 3185); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e6, v.map(Box::new), 2614); }
0xa054f => { 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, "fac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("fac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.label { w.max_len("label", v, 1024)?; w.leaf("fac:label", v)?; }
if let Some(v) = &self.operating_all_year { w.leaf("fac:operatingAllYear", v)?; }
if let Some(v) = &self.url_link_address { w.leaf("fac:urlLinkAddress", v)?; }
match &self.overall_period {
Some(v) => { v.write(w, "fac:overallPeriod", "", "")?; }
None => return Err(w.missing("fac:overallPeriod")),
}
if let Some(v) = &self.operating_hours_specification_extension { w.extension("fac:_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); },
776 => 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); },
780 => 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(389)?;
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(776)?;
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(780)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:versionTime`.
pub version_time: Option<DateTime>,
/// XML element `fac:informationManager`.
pub information_manager: Option<Box<com::InternationalIdentifier>>,
/// XML element `fac:operatingHoursSpecification`.
pub operating_hours_specification: Vec<OperatingHoursSpecification>,
/// XML element `fac:_operatingHoursTableExtension`.
pub operating_hours_table_extension: Option<Box<Extension>>,
}
impl OperatingHoursTable {
const FIELDS: &'static [u32] = &[0xa098b, 0xa0caf, 0xa08c2, 0xa0a0b, 0xa0550];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0151);
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 {
0xa098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0xa0caf => { let v = r.date_time()?; r.set(&mut e1, v, 3247); }
0xa08c2 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0xa0a0b => { let v = Some(OperatingHoursSpecification::read(r)?); e3.extend(v); }
0xa0550 => { 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("fac:name", v)?; }
match &self.version_time {
Some(v) => { w.leaf("fac:versionTime", v)?; }
None => return Err(w.missing("fac:versionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "fac:informationManager", "", "")?; }
w.count("fac:operatingHoursSpecification", self.operating_hours_specification.len(), 1, usize::MAX)?;
for v in &self.operating_hours_specification { v.write(w, "fac:operatingHoursSpecification", "", "")?; }
if let Some(v) = &self.operating_hours_table_extension { w.extension("fac:_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); } } },
781 => 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(390)?;
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(781)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:OrganisationByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationByReference {
/// XML element `fac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `fac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `fac:organisationReference`.
pub organisation_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:organisationTableReference`.
pub organisation_table_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:_organisationByReferenceExtension`.
pub organisation_by_reference_extension: Option<Box<Extension>>,
}
impl OrganisationByReference {
const FIELDS: &'static [u32] = &[0xa087b, 0xa055a, 0xa0a21, 0xa0a24, 0xa0559];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa015c);
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 {
0xa087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0xa055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0xa0a21 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e2, v.map(Box::new), 2593); }
0xa0a24 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e3, v.map(Box::new), 2596); }
0xa0559 => { 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, "fac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("fac:_organisationExtension", v)?; }
match &self.organisation_reference {
Some(v) => { v.write(w, "fac:organisationReference", "", " targetClass=\"fac:OrganisationSpecification\"")?; }
None => return Err(w.missing("fac:organisationReference")),
}
if let Some(v) = &self.organisation_table_reference { v.write(w, "fac:organisationTableReference", "", " targetClass=\"fac:OrganisationTable\"")?; }
if let Some(v) = &self.organisation_by_reference_extension { w.extension("fac:_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); },
784 => 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); },
783 => 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(392)?;
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(784)?;
w.extension(v)?;
}
match &self.organisation_reference {
Some(v) => {
w.key(1492)?;
v.write_json(w, Some("OrganisationSpecification"))?;
}
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(783)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `fac:organisationTable`.
pub organisation_table: Vec<OrganisationTable>,
/// XML element `fac:_organisationPublicationExtension`.
pub organisation_publication_extension: Option<Box<Extension>>,
}
impl OrganisationPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0xa0893, 0xa0a23, 0xa055b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa015d);
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); }
0xa0893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0xa0a23 => { let v = Some(OrganisationTable::read(r)?); e6.extend(v); }
0xa055b => { 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, "fac:headerInformation", "", "")?; }
w.count("fac:organisationTable", self.organisation_table.len(), 1, usize::MAX)?;
for v in &self.organisation_table { v.write(w, "fac:organisationTable", "", "")?; }
if let Some(v) = &self.organisation_publication_extension { w.extension("fac:_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); } } },
786 => 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(394)?;
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(786)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:OrganisationSpecification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationSpecification {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `fac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `fac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:externalCode`.
pub external_code: Option<String>,
/// XML element `fac:legalName`.
pub legal_name: Option<MultilingualString>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:linkToGeneralInformation`.
pub link_to_general_information: Option<com::Url>,
/// XML element `fac:linkToLogo`.
pub link_to_logo: Option<com::Url>,
/// XML element `fac:linkToWebform`.
pub link_to_webform: Option<com::Url>,
/// XML element `fac:available24hours`.
pub available24hours: Option<com::Boolean>,
/// XML element `fac:responsibility`.
pub responsibility: Vec<MultilingualString>,
/// XML element `fac:publishingAgreement`.
pub publishing_agreement: Option<com::Boolean>,
/// XML element `fac:type`.
pub r#type: Option<OrganisationTypeEnum>,
/// XML element `fac:nationalOrganisationNumber`.
pub national_organisation_number: Option<String>,
/// XML element `fac:nationalRegister`.
pub national_register: Option<String>,
/// XML element `fac:vatIdentificationNumber`.
pub vat_identification_number: Option<String>,
/// XML element `fac:organisationUnit`.
pub organisation_unit: Vec<OrganisationUnit>,
/// XML element `fac:subOrganisation`.
pub sub_organisation: Vec<Organisation>,
/// XML element `fac:_organisationSpecificationExtension`.
pub organisation_specification_extension: Option<Box<Extension>>,
}
impl OrganisationSpecification {
const FIELDS: &'static [u32] = &[0xa087b, 0xa055a, 0xa08f8, 0xa098b, 0xa083b, 0xa0901, 0xa07a8, 0xa0914, 0xa0915, 0xa0916, 0xa0706, 0xa0b37, 0xa0adc, 0xa0c5d, 0xa0992, 0xa0993, 0xa0c8e, 0xa0a25, 0xa0be4, 0xa055c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa015e);
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 = None;
let mut e11 = Vec::new();
let mut e12 = None;
let mut e13 = None;
let mut e14 = None;
let mut e15 = None;
let mut e16 = None;
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 {
0xa087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0xa055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e2, v, 2296); }
0xa098b => { let v = r.multilingual()?; r.set(&mut e3, v, 2443); }
0xa083b => { let v = r.string()?; r.set(&mut e4, v, 2107); }
0xa0901 => { let v = r.multilingual()?; r.set(&mut e5, v, 2305); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e6, v, 1960); }
0xa0914 => { let v = r.string()?; r.set(&mut e7, v, 2324); }
0xa0915 => { let v = r.string()?; r.set(&mut e8, v, 2325); }
0xa0916 => { let v = r.string()?; r.set(&mut e9, v, 2326); }
0xa0706 => { let v = r.value::<bool>()?; r.set(&mut e10, v, 1798); }
0xa0b37 => { let v = r.multilingual()?; e11.extend(v); }
0xa0adc => { let v = r.value::<bool>()?; r.set(&mut e12, v, 2780); }
0xa0c5d => { let v = r.enumeration::<OrganisationTypeEnum>()?; r.set(&mut e13, v, 3165); }
0xa0992 => { let v = r.string()?; r.set(&mut e14, v, 2450); }
0xa0993 => { let v = r.string()?; r.set(&mut e15, v, 2451); }
0xa0c8e => { let v = r.string()?; r.set(&mut e16, v, 3214); }
0xa0a25 => { let v = Some(OrganisationUnit::read(r)?); e17.extend(v); }
0xa0be4 => { let v = Organisation::read(r)?; e18.extend(v); }
0xa055c => { let v = r.raw()?; r.set(&mut e19, v.map(Box::new), 1372); }
_ => 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,
external_code: e4,
legal_name: e5,
description: e6,
link_to_general_information: e7,
link_to_logo: e8,
link_to_webform: e9,
available24hours: e10,
responsibility: e11,
publishing_agreement: e12,
r#type: e13,
national_organisation_number: e14,
national_register: e15,
vat_identification_number: e16,
organisation_unit: e17,
sub_organisation: e18,
organisation_specification_extension: e19,
};
r.close();
Ok(v)
}
}
impl OrganisationSpecification {
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, "fac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("fac:_organisationExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
match &self.name {
Some(v) => { w.multilingual("fac:name", v)?; }
None => return Err(w.missing("fac:name")),
}
if let Some(v) = &self.external_code { w.max_len("externalCode", v, 1024)?; w.leaf("fac:externalCode", v)?; }
if let Some(v) = &self.legal_name { w.multilingual("fac:legalName", v)?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
if let Some(v) = &self.link_to_general_information { w.leaf("fac:linkToGeneralInformation", v)?; }
if let Some(v) = &self.link_to_logo { w.leaf("fac:linkToLogo", v)?; }
if let Some(v) = &self.link_to_webform { w.leaf("fac:linkToWebform", v)?; }
if let Some(v) = &self.available24hours { w.leaf("fac:available24hours", v)?; }
for v in &self.responsibility { w.multilingual("fac:responsibility", v)?; }
if let Some(v) = &self.publishing_agreement { w.leaf("fac:publishingAgreement", v)?; }
if let Some(v) = &self.r#type { w.enumeration("fac:type", v.literal())?; }
if let Some(v) = &self.national_organisation_number { w.max_len("nationalOrganisationNumber", v, 1024)?; w.leaf("fac:nationalOrganisationNumber", v)?; }
if let Some(v) = &self.national_register { w.max_len("nationalRegister", v, 1024)?; w.leaf("fac:nationalRegister", v)?; }
if let Some(v) = &self.vat_identification_number { w.max_len("vatIdentificationNumber", v, 1024)?; w.leaf("fac:vatIdentificationNumber", v)?; }
w.count("fac:organisationUnit", self.organisation_unit.len(), 1, usize::MAX)?;
for v in &self.organisation_unit { v.write(w, "fac:organisationUnit", "", "")?; }
for v in &self.sub_organisation { v.write(w, "fac:subOrganisation")?; }
if let Some(v) = &self.organisation_specification_extension { w.extension("fac:_organisationSpecificationExtension", v)?; }
w.end(tag)
}
}
impl OrganisationSpecification {
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; 22];
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;
let mut f18 = None;
let mut f19 = Vec::new();
let mut f20 = Vec::new();
let mut f21 = 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); },
784 => 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()?; },
734 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1052 => if r.first(&mut seen[7])? { f7 = r.multilingual()?; },
545 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
1071 => if r.first(&mut seen[9])? { f9 = r.string()?; },
1072 => if r.first(&mut seen[10])? { f10 = r.string()?; },
1073 => if r.first(&mut seen[11])? { f11 = r.string()?; },
273 => if r.first(&mut seen[12])? { f12 = r.boolean()?; },
1894 => if r.first(&mut seen[13])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { f13.push(v); } } },
1780 => if r.first(&mut seen[14])? { f14 = r.boolean()?; },
2495 => if r.first(&mut seen[15])? { f15 = r.enumeration::<OrganisationTypeEnum>()?; },
1351 => if r.first(&mut seen[16])? { f16 = r.string()?; },
1352 => if r.first(&mut seen[17])? { f17 = r.string()?; },
2547 => if r.first(&mut seen[18])? { f18 = r.string()?; },
1496 => if r.first(&mut seen[19])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OrganisationUnit::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); } } },
788 => if r.first(&mut seen[21])? { f21 = 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,
external_code: f6,
legal_name: f7,
description: f8,
link_to_general_information: f9,
link_to_logo: f10,
link_to_webform: f11,
available24hours: f12,
responsibility: f13,
publishing_agreement: f14,
r#type: f15,
national_organisation_number: f16,
national_register: f17,
vat_identification_number: f18,
organisation_unit: f19,
sub_organisation: f20,
organisation_specification_extension: f21,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(395)?;
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(784)?;
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.external_code {
w.key(734)?;
w.max_len("externalCode", v, 1024)?; w.string(v)?;
}
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(397, 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)?;
}
w.count("organisationUnit", self.organisation_unit.len(), 1, usize::MAX)?;
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.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.organisation_specification_extension {
w.key(788)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:versionTime`.
pub version_time: Option<DateTime>,
/// XML element `fac:informationManager`.
pub information_manager: Option<Box<com::InternationalIdentifier>>,
/// XML element `fac:organisationSpecification`.
pub organisation_specification: Vec<OrganisationSpecification>,
/// XML element `fac:_organisationTableExtension`.
pub organisation_table_extension: Option<Box<Extension>>,
}
impl OrganisationTable {
const FIELDS: &'static [u32] = &[0xa098b, 0xa0caf, 0xa08c2, 0xa0a22, 0xa055d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa015f);
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 {
0xa098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0xa0caf => { let v = r.date_time()?; r.set(&mut e1, v, 3247); }
0xa08c2 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e2, v.map(Box::new), 2242); }
0xa0a22 => { let v = Some(OrganisationSpecification::read(r)?); e3.extend(v); }
0xa055d => { 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,
organisation_specification: 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("fac:name", v)?; }
match &self.version_time {
Some(v) => { w.leaf("fac:versionTime", v)?; }
None => return Err(w.missing("fac:versionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "fac:informationManager", "", "")?; }
w.count("fac:organisationSpecification", self.organisation_specification.len(), 1, usize::MAX)?;
for v in &self.organisation_specification { v.write(w, "fac:organisationSpecification", "", "")?; }
if let Some(v) = &self.organisation_table_extension { w.extension("fac:_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); },
1493 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OrganisationSpecification::read_json(r)? { f5.push(v); } } },
789 => 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,
organisation_specification: f5,
organisation_table_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(396)?;
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("organisationSpecification", self.organisation_specification.len(), 1, usize::MAX)?;
if !self.organisation_specification.is_empty() {
w.key(1493)?;
w.begin_array()?;
for v in &self.organisation_specification {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.organisation_table_extension {
w.key(789)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:OrganisationUnit`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OrganisationUnit {
/// XML element `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:function`.
pub function: Vec<MultilingualString>,
/// XML element `fac:locationReference`.
pub location_reference: Option<loc::LocationReference>,
/// XML element `fac:contactInformation`.
pub contact_information: Vec<AnyContactInformation>,
/// XML element `fac:operatingHours`.
pub operating_hours: Option<OperatingHours>,
/// XML element `fac:_organisationUnitExtension`.
pub organisation_unit_extension: Option<Box<Extension>>,
}
impl OrganisationUnit {
const FIELDS: &'static [u32] = &[0xa098b, 0xa0872, 0xa0926, 0xa0768, 0xa0a09, 0xa055e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0160);
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 {
0xa098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0xa0872 => { let v = r.multilingual()?; e1.extend(v); }
0xa0926 => { let v = loc::LocationReference::read(r)?; r.set(&mut e2, v, 2342); }
0xa0768 => { let v = AnyContactInformation::read(r)?; e3.extend(v); }
0xa0a09 => { let v = OperatingHours::read(r)?; r.set(&mut e4, v, 2569); }
0xa055e => { 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("fac:name", v)?; }
for v in &self.function { w.multilingual("fac:function", v)?; }
if let Some(v) = &self.location_reference { v.write(w, "fac:locationReference")?; }
for v in &self.contact_information { v.write(w, "fac:contactInformation")?; }
if let Some(v) = &self.operating_hours { v.write(w, "fac:operatingHours")?; }
if let Some(v) = &self.organisation_unit_extension { w.extension("fac:_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)?; },
790 => 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(398)?;
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(790)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:PaymentMethod`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PaymentMethod {
/// XML element `fac:paymentMeans`.
pub payment_means: Vec<MeansOfPaymentEnum>,
/// XML element `fac:paymentMode`.
pub payment_mode: Vec<PaymentTimingEnum>,
/// XML element `fac:brandsAcceptedText`.
pub brands_accepted_text: Vec<BrandsAcceptedText>,
/// XML element `fac:brandsAcceptedCodeList`.
pub brands_accepted_code_list: Vec<BrandsAcceptedCodeList>,
/// XML element `fac:_paymentMethodExtension`.
pub payment_method_extension: Option<Box<Extension>>,
}
impl PaymentMethod {
const FIELDS: &'static [u32] = &[0xa0a58, 0xa0a5a, 0xa072a, 0xa0728, 0xa056c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa016e);
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 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0a58 => { let v = r.enumeration::<MeansOfPaymentEnum>()?; e0.extend(v); }
0xa0a5a => { let v = r.enumeration::<PaymentTimingEnum>()?; e1.extend(v); }
0xa072a => { let v = Some(BrandsAcceptedText::read(r)?); e2.extend(v); }
0xa0728 => { let v = Some(BrandsAcceptedCodeList::read(r)?); e3.extend(v); }
0xa056c => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1388); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
payment_means: e0,
payment_mode: e1,
brands_accepted_text: e2,
brands_accepted_code_list: e3,
payment_method_extension: e4,
};
r.close();
Ok(v)
}
}
impl PaymentMethod {
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_means { w.enumeration("fac:paymentMeans", v.literal())?; }
for v in &self.payment_mode { w.enumeration("fac:paymentMode", v.literal())?; }
for v in &self.brands_accepted_text { v.write(w, "fac:brandsAcceptedText", "", "")?; }
for v in &self.brands_accepted_code_list { v.write(w, "fac:brandsAcceptedCodeList", "", "")?; }
if let Some(v) = &self.payment_method_extension { w.extension("fac:_paymentMethodExtension", v)?; }
w.end(tag)
}
}
impl PaymentMethod {
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 = Vec::new();
let mut f2 = Vec::new();
let mut f3 = Vec::new();
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 {
1547 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<MeansOfPaymentEnum>()? { f0.push(v); } } },
1549 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<PaymentTimingEnum>()? { f1.push(v); } } },
309 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = BrandsAcceptedText::read_json(r)? { f2.push(v); } } },
307 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = BrandsAcceptedCodeList::read_json(r)? { f3.push(v); } } },
791 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
payment_means: f0,
payment_mode: f1,
brands_accepted_text: f2,
brands_accepted_code_list: f3,
payment_method_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(400)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.payment_means.is_empty() {
w.key(1547)?;
w.begin_array()?;
for v in &self.payment_means {
w.item()?;
w.enumeration(383, v.literal())?;
}
w.end_array()?;
}
if !self.payment_mode.is_empty() {
w.key(1549)?;
w.begin_array()?;
for v in &self.payment_mode {
w.item()?;
w.enumeration(401, v.literal())?;
}
w.end_array()?;
}
if !self.brands_accepted_text.is_empty() {
w.key(309)?;
w.begin_array()?;
for v in &self.brands_accepted_text {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.brands_accepted_code_list.is_empty() {
w.key(307)?;
w.begin_array()?;
for v in &self.brands_accepted_code_list {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.payment_method_extension {
w.key(791)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:Qualification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Qualification {
/// XML element `fac:withReservation`.
pub with_reservation: Option<com::Boolean>,
/// XML element `fac:propulsionEnergyType`.
pub propulsion_energy_type: Vec<EnergySourceEnum>,
/// XML element `fac:noFeeToUse`.
pub no_fee_to_use: Option<com::Boolean>,
/// XML element `fac:withMembership`.
pub with_membership: Option<com::Boolean>,
/// XML element `fac:membershipName`.
pub membership_name: Vec<MultilingualString>,
/// XML element `fac:memberOfOtherRateTable`.
pub member_of_other_rate_table: Option<com::Boolean>,
/// XML element `fac:rateTableMember`.
pub rate_table_member: Vec<com::VersionedReference>,
/// XML element `fac:activeAssignedRight`.
pub active_assigned_right: Option<String>,
/// XML element `fac:paymentMethod`.
pub payment_method: Vec<PaymentMethod>,
/// XML element `fac:vehicleCharacteristics`.
pub vehicle_characteristics: Vec<com::VehicleCharacteristics>,
/// XML element `fac:userQualification`.
pub user_qualification: Vec<UserQualification>,
/// XML element `fac:_qualificationExtension`.
pub qualification_extension: Option<Box<Extension>>,
}
impl Qualification {
const FIELDS: &'static [u32] = &[0xa0ce0, 0xa0acc, 0xa099e, 0xa0cdf, 0xa0968, 0xa0967, 0xa0af3, 0xa06ad, 0xa0a59, 0xa0c90, 0xa0c7d, 0xa05a5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01a8);
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 = Vec::new();
let mut e11 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0ce0 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 3296); }
0xa0acc => { let v = r.enumeration::<EnergySourceEnum>()?; e1.extend(v); }
0xa099e => { let v = r.value::<bool>()?; r.set(&mut e2, v, 2462); }
0xa0cdf => { let v = r.value::<bool>()?; r.set(&mut e3, v, 3295); }
0xa0968 => { let v = r.multilingual()?; e4.extend(v); }
0xa0967 => { let v = r.value::<bool>()?; r.set(&mut e5, v, 2407); }
0xa0af3 => { let v = Some(com::VersionedReference::read(r)?); e6.extend(v); }
0xa06ad => { let v = r.string()?; r.set(&mut e7, v, 1709); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); e8.extend(v); }
0xa0c90 => { let v = Some(com::VehicleCharacteristics::read(r)?); e9.extend(v); }
0xa0c7d => { let v = Some(UserQualification::read(r)?); e10.extend(v); }
0xa05a5 => { let v = r.raw()?; r.set(&mut e11, 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_method: e8,
vehicle_characteristics: e9,
user_qualification: e10,
qualification_extension: e11,
};
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("fac:withReservation", v)?; }
for v in &self.propulsion_energy_type { w.enumeration("fac:propulsionEnergyType", v.literal())?; }
if let Some(v) = &self.no_fee_to_use { w.leaf("fac:noFeeToUse", v)?; }
if let Some(v) = &self.with_membership { w.leaf("fac:withMembership", v)?; }
for v in &self.membership_name { w.multilingual("fac:membershipName", v)?; }
if let Some(v) = &self.member_of_other_rate_table { w.leaf("fac:memberOfOtherRateTable", v)?; }
for v in &self.rate_table_member { v.write(w, "fac:rateTableMember", "", " targetClass=\"fac:RateTable\"")?; }
if let Some(v) = &self.active_assigned_right { w.max_len("activeAssignedRight", v, 1024)?; w.leaf("fac:activeAssignedRight", v)?; }
for v in &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
for v in &self.vehicle_characteristics { v.write(w, "fac:vehicleCharacteristics", "", "")?; }
for v in &self.user_qualification { v.write(w, "fac:userQualification", "", "")?; }
if let Some(v) = &self.qualification_extension { w.extension("fac:_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; 12];
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 = 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 {
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()?; },
1548 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = PaymentMethod::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); } } },
2530 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = UserQualification::read_json(r)? { f10.push(v); } } },
792 => if r.first(&mut seen[11])? { f11 = 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_method: f8,
vehicle_characteristics: f9,
user_qualification: f10,
qualification_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(402)?;
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(374, 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_method.is_empty() {
w.key(1548)?;
w.begin_array()?;
for v in &self.payment_method {
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 !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(792)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RateDiscount`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateDiscount {
/// XML element `fac:discountRate`.
pub discount_rate: Option<com::Percentage>,
/// XML element `fac:fixedValue`.
pub fixed_value: Option<Box<AmountInCurrency>>,
/// XML element `fac:_rateDiscountExtension`.
pub rate_discount_extension: Option<Box<Extension>>,
}
impl RateDiscount {
const FIELDS: &'static [u32] = &[0xa07c4, 0xa085f, 0xa05a6];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01a9);
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 {
0xa07c4 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 1988); }
0xa085f => { let v = Some(AmountInCurrency::read(r)?); r.set(&mut e1, v.map(Box::new), 2143); }
0xa05a6 => { 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("fac:discountRate", v)?; }
if let Some(v) = &self.fixed_value { v.write(w, "fac:fixedValue", "", "")?; }
if let Some(v) = &self.rate_discount_extension { w.extension("fac:_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); },
793 => 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(404)?;
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(793)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RateEligibility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateEligibility {
/// XML element `fac:priority`.
pub priority: Option<com::Integer>,
/// XML element `fac:combinable`.
pub combinable: Option<com::Boolean>,
/// XML element `fac:rateDiscount`.
pub rate_discount: Option<Box<RateDiscount>>,
/// XML element `fac:eligibility`.
pub eligibility: Option<Box<Eligibility>>,
/// XML element `fac:rightSpecification`.
pub right_specification: Vec<RightSpecification>,
/// XML element `fac:_rateEligibilityExtension`.
pub rate_eligibility_extension: Option<Box<Extension>>,
}
impl RateEligibility {
const FIELDS: &'static [u32] = &[0xa0abf, 0xa0751, 0xa0ae5, 0xa07f2, 0xa0b3f, 0xa05a7];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01aa);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0abf => { let v = r.value::<i64>()?; r.set(&mut e0, v, 2751); }
0xa0751 => { let v = r.value::<bool>()?; r.set(&mut e1, v, 1873); }
0xa0ae5 => { let v = Some(RateDiscount::read(r)?); r.set(&mut e2, v.map(Box::new), 2789); }
0xa07f2 => { let v = Some(Eligibility::read(r)?); r.set(&mut e3, v.map(Box::new), 2034); }
0xa0b3f => { let v = Some(RightSpecification::read(r)?); e4.extend(v); }
0xa05a7 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1447); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2034);
let v = Self {
priority: e0,
combinable: e1,
rate_discount: e2,
eligibility: e3,
right_specification: e4,
rate_eligibility_extension: e5,
};
r.close();
Ok(v)
}
}
impl RateEligibility {
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.priority { w.leaf("fac:priority", v)?; }
if let Some(v) = &self.combinable { w.leaf("fac:combinable", v)?; }
if let Some(v) = &self.rate_discount { v.write(w, "fac:rateDiscount", "", "")?; }
match &self.eligibility {
Some(v) => { v.write(w, "fac:eligibility", "", "")?; }
None => return Err(w.missing("fac:eligibility")),
}
for v in &self.right_specification { v.write(w, "fac:rightSpecification", "", "")?; }
if let Some(v) = &self.rate_eligibility_extension { w.extension("fac:_rateEligibilityExtension", v)?; }
w.end(tag)
}
}
impl RateEligibility {
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 = 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 {
1649 => if r.first(&mut seen[0])? { f0 = r.number::<i64>()?; },
415 => if r.first(&mut seen[1])? { f1 = r.boolean()?; },
1789 => if r.first(&mut seen[2])? { f2 = RateDiscount::read_json(r)?.map(Box::new); },
654 => if r.first(&mut seen[3])? { f3 = Eligibility::read_json(r)?.map(Box::new); },
1902 => if r.first(&mut seen[4])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RightSpecification::read_json(r)? { f4.push(v); } } },
794 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f3, 654);
Ok(Self {
priority: f0,
combinable: f1,
rate_discount: f2,
eligibility: f3,
right_specification: f4,
rate_eligibility_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(405)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
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 let Some(v) = &self.rate_discount {
w.key(1789)?;
v.write_json(w, None)?;
}
match &self.eligibility {
Some(v) => {
w.key(654)?;
v.write_json(w, None)?;
}
None => w.absent(654, w.missing("eligibility"))?,
}
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.rate_eligibility_extension {
w.key(794)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RateLine`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateLine {
/// XML attribute `sequence`.
pub sequence: Option<com::Integer>,
/// XML element `fac:rateLineType`.
pub rate_line_type: Option<RateLineTypeEnum>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:durationStart`.
pub duration_start: Option<Time>,
/// XML element `fac:durationEnd`.
pub duration_end: Option<Time>,
/// XML element `fac:incrementPeriod`.
pub increment_period: Option<Duration>,
/// XML element `fac:value`.
pub value: Option<AmountOfMoney>,
/// XML element `fac:minValue`.
pub min_value: Option<AmountOfMoney>,
/// XML element `fac:maxValue`.
pub max_value: Option<AmountOfMoney>,
/// XML element `fac:usageCondition`.
pub usage_condition: Option<RateUsageConditionsTypeEnum>,
/// XML element `fac:surcharge`.
pub surcharge: Vec<Surcharge>,
/// XML element `fac:rateLineTax`.
pub rate_line_tax: Vec<RateLineTax>,
/// XML element `fac:_rateLineExtension`.
pub rate_line_extension: Option<Box<Extension>>,
}
impl RateLine {
const FIELDS: &'static [u32] = &[0xa0aea, 0xa07a8, 0xa07dd, 0xa07dc, 0xa08bc, 0xa0c8c, 0xa0975, 0xa0942, 0xa0c77, 0xa0bf7, 0xa0ae9, 0xa05a9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01ab);
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 = Vec::new();
let mut e10 = Vec::new();
let mut e11 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0aea => { let v = r.enumeration::<RateLineTypeEnum>()?; r.set(&mut e0, v, 2794); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e1, v, 1960); }
0xa07dd => { let v = r.value::<Time>()?; r.set(&mut e2, v, 2013); }
0xa07dc => { let v = r.value::<Time>()?; r.set(&mut e3, v, 2012); }
0xa08bc => { let v = r.string()?; r.set(&mut e4, v, 2236); }
0xa0c8c => { let v = r.value::<Decimal>()?; r.set(&mut e5, v, 3212); }
0xa0975 => { let v = r.value::<Decimal>()?; r.set(&mut e6, v, 2421); }
0xa0942 => { let v = r.value::<Decimal>()?; r.set(&mut e7, v, 2370); }
0xa0c77 => { let v = r.enumeration::<RateUsageConditionsTypeEnum>()?; r.set(&mut e8, v, 3191); }
0xa0bf7 => { let v = Some(Surcharge::read(r)?); e9.extend(v); }
0xa0ae9 => { let v = Some(RateLineTax::read(r)?); e10.extend(v); }
0xa05a9 => { let v = r.raw()?; r.set(&mut e11, 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,
surcharge: e9,
rate_line_tax: e10,
rate_line_extension: e11,
};
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("fac:rateLineType", v.literal())?; }
None => return Err(w.missing("fac:rateLineType")),
}
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
if let Some(v) = &self.duration_start { w.leaf("fac:durationStart", v)?; }
if let Some(v) = &self.duration_end { w.leaf("fac:durationEnd", v)?; }
if let Some(v) = &self.increment_period { w.pattern("incrementPeriod", v, Pattern::Duration)?; w.leaf("fac:incrementPeriod", v)?; }
match &self.value {
Some(v) => { w.digits("value", v, 8, 2)?; w.leaf("fac:value", v)?; }
None => return Err(w.missing("fac:value")),
}
if let Some(v) = &self.min_value { w.digits("minValue", v, 8, 2)?; w.leaf("fac:minValue", v)?; }
if let Some(v) = &self.max_value { w.digits("maxValue", v, 8, 2)?; w.leaf("fac:maxValue", v)?; }
if let Some(v) = &self.usage_condition { w.enumeration("fac:usageCondition", v.literal())?; }
for v in &self.surcharge { v.write(w, "fac:surcharge", "", "")?; }
for v in &self.rate_line_tax { v.write(w, "fac:rateLineTax", "", "")?; }
if let Some(v) = &self.rate_line_extension { w.extension("fac:_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; 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 = Vec::new();
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 {
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::<RateUsageConditionsTypeEnum>()?; },
2226 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Surcharge::read_json(r)? { f10.push(v); } } },
1793 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateLineTax::read_json(r)? { f11.push(v); } } },
797 => if r.first(&mut seen[12])? { f12 = 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,
surcharge: f10,
rate_line_tax: f11,
rate_line_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(406)?;
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(410, 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(414, v.literal())?;
}
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(797)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RateLineCollection`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateLineCollection {
/// XML attribute `collectionSequence`.
pub collection_sequence: Option<com::Integer>,
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Option<CurrencyCode>,
/// XML element `fac:minValueCollection`.
pub min_value_collection: Option<AmountOfMoney>,
/// XML element `fac:maxValueCollection`.
pub max_value_collection: Option<AmountOfMoney>,
/// XML element `fac:validStart`.
pub valid_start: Option<DateTime>,
/// XML element `fac:validEnd`.
pub valid_end: Option<DateTime>,
/// XML element `fac:minTime`.
pub min_time: Option<Duration>,
/// XML element `fac:maxTime`.
pub max_time: Option<Duration>,
/// XML element `fac:resetTime`.
pub reset_time: Option<Time>,
/// XML element `fac:taxIncluded`.
pub tax_included: Option<com::Boolean>,
/// XML element `fac:taxRate`.
pub tax_rate: Option<com::Percentage>,
/// XML element `fac:taxValue`.
pub tax_value: Option<AmountOfMoney>,
/// XML element `fac:relativeTimes`.
pub relative_times: Option<com::Boolean>,
/// XML element `fac:rateLine`.
pub rate_line: Vec<RateLine>,
/// XML element `fac:_rateLineCollectionExtension`.
pub rate_line_collection_extension: Option<Box<Extension>>,
}
impl RateLineCollection {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0976, 0xa0943, 0xa0c84, 0xa0c82, 0xa0974, 0xa0941, 0xa0b2f, 0xa0c00, 0xa0c01, 0xa0c02, 0xa0b1f, 0xa0ae7, 0xa05a8];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01ac);
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 {
0xa06e8 => { let v = r.string()?; r.set(&mut e0, v, 1768); }
0xa0976 => { let v = r.value::<Decimal>()?; r.set(&mut e1, v, 2422); }
0xa0943 => { let v = r.value::<Decimal>()?; r.set(&mut e2, v, 2371); }
0xa0c84 => { let v = r.date_time()?; r.set(&mut e3, v, 3204); }
0xa0c82 => { let v = r.date_time()?; r.set(&mut e4, v, 3202); }
0xa0974 => { let v = r.string()?; r.set(&mut e5, v, 2420); }
0xa0941 => { let v = r.string()?; r.set(&mut e6, v, 2369); }
0xa0b2f => { let v = r.value::<Time>()?; r.set(&mut e7, v, 2863); }
0xa0c00 => { let v = r.value::<bool>()?; r.set(&mut e8, v, 3072); }
0xa0c01 => { let v = r.value::<f32>()?; r.set(&mut e9, v, 3073); }
0xa0c02 => { let v = r.value::<Decimal>()?; r.set(&mut e10, v, 3074); }
0xa0b1f => { let v = r.value::<bool>()?; r.set(&mut e11, v, 2847); }
0xa0ae7 => { let v = Some(RateLine::read(r)?); e12.extend(v); }
0xa05a8 => { 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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.min_value_collection { w.digits("minValueCollection", v, 8, 2)?; w.leaf("fac:minValueCollection", v)?; }
if let Some(v) = &self.max_value_collection { w.digits("maxValueCollection", v, 8, 2)?; w.leaf("fac:maxValueCollection", v)?; }
if let Some(v) = &self.valid_start { w.leaf("fac:validStart", v)?; }
if let Some(v) = &self.valid_end { w.leaf("fac:validEnd", v)?; }
if let Some(v) = &self.min_time { w.pattern("minTime", v, Pattern::Duration)?; w.leaf("fac:minTime", v)?; }
if let Some(v) = &self.max_time { w.pattern("maxTime", v, Pattern::Duration)?; w.leaf("fac:maxTime", v)?; }
if let Some(v) = &self.reset_time { w.leaf("fac:resetTime", v)?; }
if let Some(v) = &self.tax_included { w.leaf("fac:taxIncluded", v)?; }
if let Some(v) = &self.tax_rate { w.leaf("fac:taxRate", v)?; }
if let Some(v) = &self.tax_value { w.digits("taxValue", v, 8, 2)?; w.leaf("fac:taxValue", v)?; }
if let Some(v) = &self.relative_times { w.leaf("fac:relativeTimes", v)?; }
w.count("fac:rateLine", self.rate_line.len(), 1, usize::MAX)?;
for v in &self.rate_line { v.write(w, "fac:rateLine", "", "")?; }
if let Some(v) = &self.rate_line_collection_extension { w.extension("fac:_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); } } },
796 => 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(407)?;
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(796)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RateLineTax`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RateLineTax {
/// XML element `fac:taxValue`.
pub tax_value: Option<AmountOfMoney>,
/// XML element `fac:taxRate`.
pub tax_rate: Option<com::Percentage>,
/// XML element `fac:taxIncluded`.
pub tax_included: Option<com::Boolean>,
/// XML element `fac:trigger`.
pub trigger: Option<MultilingualString>,
/// XML element `fac:labelForDisplay`.
pub label_for_display: Option<MultilingualString>,
/// XML element `fac:_rateLineTaxExtension`.
pub rate_line_tax_extension: Option<Box<Extension>>,
}
impl RateLineTax {
const FIELDS: &'static [u32] = &[0xa0c02, 0xa0c01, 0xa0c00, 0xa0c57, 0xa08e8, 0xa05aa];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01ad);
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 {
0xa0c02 => { let v = r.value::<Decimal>()?; r.set(&mut e0, v, 3074); }
0xa0c01 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3073); }
0xa0c00 => { let v = r.value::<bool>()?; r.set(&mut e2, v, 3072); }
0xa0c57 => { let v = r.multilingual()?; r.set(&mut e3, v, 3159); }
0xa08e8 => { let v = r.multilingual()?; r.set(&mut e4, v, 2280); }
0xa05aa => { 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("fac:taxValue", v)?; }
if let Some(v) = &self.tax_rate { w.leaf("fac:taxRate", v)?; }
match &self.tax_included {
Some(v) => { w.leaf("fac:taxIncluded", v)?; }
None => return Err(w.missing("fac:taxIncluded")),
}
if let Some(v) = &self.trigger { w.multilingual("fac:trigger", v)?; }
if let Some(v) = &self.label_for_display { w.multilingual("fac:labelForDisplay", v)?; }
if let Some(v) = &self.rate_line_tax_extension { w.extension("fac:_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()?; },
798 => 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(409)?;
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(798)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:versionTime`.
pub version_time: Option<DateTime>,
/// XML element `fac:informationManager`.
pub information_manager: Option<Box<com::InternationalIdentifier>>,
/// XML element `fac:rateTable`.
pub rate_table: Vec<RateTable>,
/// XML element `fac:_rateMatrixExtension`.
pub rate_matrix_extension: Option<Box<Extension>>,
}
impl RateMatrix {
const FIELDS: &'static [u32] = &[0xa098b, 0xa07a8, 0xa0caf, 0xa08c2, 0xa0af2, 0xa05ac];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01ae);
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 = Vec::new();
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e1, v, 1960); }
0xa0caf => { let v = r.date_time()?; r.set(&mut e2, v, 3247); }
0xa08c2 => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2242); }
0xa0af2 => { let v = Some(RateTable::read(r)?); e4.extend(v); }
0xa05ac => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1452); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 3247);
let v = Self {
id: a0,
version: a1,
name: e0,
description: e1,
version_time: e2,
information_manager: e3,
rate_table: e4,
rate_matrix_extension: e5,
};
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")),
}
if let Some(v) = &self.name { w.multilingual("fac:name", v)?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
match &self.version_time {
Some(v) => { w.leaf("fac:versionTime", v)?; }
None => return Err(w.missing("fac:versionTime")),
}
if let Some(v) = &self.information_manager { v.write(w, "fac:informationManager", "", "")?; }
w.count("fac:rateTable", self.rate_table.len(), 1, usize::MAX)?;
for v in &self.rate_table { v.write(w, "fac:rateTable", "", "")?; }
if let Some(v) = &self.rate_matrix_extension { w.extension("fac:_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; 8];
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 = Vec::new();
let mut f7 = 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()?; },
545 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
2580 => if r.first(&mut seen[4])? { f4 = r.date_time()?; },
989 => if r.first(&mut seen[5])? { f5 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
1802 => if r.first(&mut seen[6])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = RateTable::read_json(r)? { f6.push(v); } } },
799 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f4, 2580);
Ok(Self {
id: f0,
version: f1,
name: f2,
description: f3,
version_time: f4,
information_manager: f5,
rate_table: f6,
rate_matrix_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(411)?;
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 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(799)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `fac:paymentMethod`.
pub payment_method: Option<Box<PaymentMethod>>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:energyPricingPolicy`.
pub energy_pricing_policy: Option<Box<egi::EnergyPricingPolicy>>,
/// XML element `fac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:rateTableName`.
pub rate_table_name: Option<MultilingualString>,
/// XML element `fac:activeTimes`.
pub active_times: Vec<Duration>,
/// XML element `fac:availability`.
pub availability: Option<RateAvailabilityTypeEnum>,
/// XML element `fac:rateResponsibleParty`.
pub rate_responsible_party: Option<Box<com::VersionedReference>>,
/// XML element `fac:rateSupersedeLink`.
pub rate_supersede_link: Option<Box<com::VersionedReference>>,
/// XML element `fac:validation`.
pub validation: Option<com::Boolean>,
/// XML element `fac:rateType`.
pub rate_type: Option<RateTypeEnum>,
/// XML element `fac:validityStart`.
pub validity_start: Option<DateTime>,
/// XML element `fac:validityEnd`.
pub validity_end: Option<DateTime>,
/// XML element `fac:additionalInformation`.
pub additional_information: Option<com::Url>,
/// XML element `fac:rateLineCollection`.
pub rate_line_collection: Vec<AnyRateLineCollection>,
/// XML element `fac:rateEligibility`.
pub rate_eligibility: Option<Box<RateEligibility>>,
/// XML element `fac:_rateTableExtension`.
pub rate_table_extension: Option<Box<Extension>>,
}
impl RateTable {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0a59, 0xa0a36, 0xa0809, 0xa05b0, 0xa08f8, 0xa0af4, 0xa06ae, 0xa0705, 0xa0af0, 0xa0af1, 0xa0c85, 0xa0af6, 0xa0c89, 0xa0c88, 0xa06b9, 0xa0ae8, 0xa0ae6, 0xa05ae];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01b0);
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 = Vec::new();
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 = None;
let mut e16 = Vec::new();
let mut e17 = None;
let mut e18 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa06e8 => { let v = r.string()?; e0.extend(v); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); r.set(&mut e1, v.map(Box::new), 2649); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0xa0809 => { let v = Some(egi::EnergyPricingPolicy::read(r)?); r.set(&mut e3, v.map(Box::new), 2057); }
0xa05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e5, v, 2296); }
0xa0af4 => { let v = r.multilingual()?; r.set(&mut e6, v, 2804); }
0xa06ae => { let v = r.string()?; e7.extend(v); }
0xa0705 => { let v = r.enumeration::<RateAvailabilityTypeEnum>()?; r.set(&mut e8, v, 1797); }
0xa0af0 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e9, v.map(Box::new), 2800); }
0xa0af1 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e10, v.map(Box::new), 2801); }
0xa0c85 => { let v = r.value::<bool>()?; r.set(&mut e11, v, 3205); }
0xa0af6 => { let v = r.enumeration::<RateTypeEnum>()?; r.set(&mut e12, v, 2806); }
0xa0c89 => { let v = r.date_time()?; r.set(&mut e13, v, 3209); }
0xa0c88 => { let v = r.date_time()?; r.set(&mut e14, v, 3208); }
0xa06b9 => { let v = r.string()?; r.set(&mut e15, v, 1721); }
0xa0ae8 => { let v = AnyRateLineCollection::read(r)?; e16.extend(v); }
0xa0ae6 => { let v = Some(RateEligibility::read(r)?); r.set(&mut e17, v.map(Box::new), 2790); }
0xa05ae => { let v = r.raw()?; r.set(&mut e18, 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_method: e1,
overall_period: e2,
energy_pricing_policy: e3,
rates_extension: e4,
last_updated: e5,
rate_table_name: e6,
active_times: e7,
availability: e8,
rate_responsible_party: e9,
rate_supersede_link: e10,
validation: e11,
rate_type: e12,
validity_start: e13,
validity_end: e14,
additional_information: e15,
rate_line_collection: e16,
rate_eligibility: e17,
rate_table_extension: e18,
};
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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "fac:overallPeriod", "", "")?; }
if let Some(v) = &self.energy_pricing_policy { v.write(w, "fac:energyPricingPolicy", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("fac:_ratesExtension", v)?; }
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.rate_table_name { w.multilingual("fac:rateTableName", v)?; }
for v in &self.active_times { w.pattern("activeTimes", v, Pattern::Duration)?; w.leaf("fac:activeTimes", v)?; }
if let Some(v) = &self.availability { w.enumeration("fac:availability", v.literal())?; }
if let Some(v) = &self.rate_responsible_party { v.write(w, "fac:rateResponsibleParty", "", " targetClass=\"fac:Organisation\"")?; }
if let Some(v) = &self.rate_supersede_link { v.write(w, "fac:rateSupersedeLink", "", " targetClass=\"fac:RateTable\"")?; }
if let Some(v) = &self.validation { w.leaf("fac:validation", v)?; }
if let Some(v) = &self.rate_type { w.enumeration("fac:rateType", v.literal())?; }
if let Some(v) = &self.validity_start { w.leaf("fac:validityStart", v)?; }
if let Some(v) = &self.validity_end { w.leaf("fac:validityEnd", v)?; }
if let Some(v) = &self.additional_information { w.leaf("fac:additionalInformation", v)?; }
for v in &self.rate_line_collection { v.write(w, "fac:rateLineCollection")?; }
if let Some(v) = &self.rate_eligibility { v.write(w, "fac:rateEligibility", "", "")?; }
if let Some(v) = &self.rate_table_extension { w.extension("fac:_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; 21];
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 = Vec::new();
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 = None;
let mut f18 = Vec::new();
let mut f19 = None;
let mut f20 = 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); } } },
1548 => if r.first(&mut seen[3])? { f3 = PaymentMethod::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[4])? { f4 = com::OverallPeriod::read_json(r)?.map(Box::new); },
676 => if r.first(&mut seen[5])? { f5 = egi::EnergyPricingPolicy::read_json(r)?.map(Box::new); },
804 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
1043 => if r.first(&mut seen[7])? { f7 = r.date_time()?; },
1804 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
50 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f9.push(v); } } },
272 => if r.first(&mut seen[10])? { f10 = r.enumeration::<RateAvailabilityTypeEnum>()?; },
1800 => if r.first(&mut seen[11])? { f11 = com::VersionedReference::read_json(r)?.map(Box::new); },
1801 => if r.first(&mut seen[12])? { f12 = com::VersionedReference::read_json(r)?.map(Box::new); },
2538 => if r.first(&mut seen[13])? { f13 = r.boolean()?; },
1806 => if r.first(&mut seen[14])? { f14 = r.enumeration::<RateTypeEnum>()?; },
2542 => if r.first(&mut seen[15])? { f15 = r.date_time()?; },
2541 => if r.first(&mut seen[16])? { f16 = r.date_time()?; },
61 => if r.first(&mut seen[17])? { f17 = r.string()?; },
1792 => if r.first(&mut seen[18])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyRateLineCollection::read_json(r)? { f18.push(v); } } },
1790 => if r.first(&mut seen[19])? { f19 = RateEligibility::read_json(r)?.map(Box::new); },
801 => if r.first(&mut seen[20])? { f20 = 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_method: f3,
overall_period: f4,
energy_pricing_policy: f5,
rates_extension: f6,
last_updated: f7,
rate_table_name: f8,
active_times: f9,
availability: f10,
rate_responsible_party: f11,
rate_supersede_link: f12,
validation: f13,
rate_type: f14,
validity_start: f15,
validity_end: f16,
additional_information: f17,
rate_line_collection: f18,
rate_eligibility: f19,
rate_table_extension: f20,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(412)?;
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_method {
w.key(1548)?;
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.energy_pricing_policy {
w.key(676)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(804)?;
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(403, v.literal())?;
}
if let Some(v) = &self.rate_responsible_party {
w.key(1800)?;
v.write_json(w, Some("Organisation"))?;
}
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(413, 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.rate_eligibility {
w.key(1790)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rate_table_extension {
w.key(801)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RatesByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RatesByReference {
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `fac:paymentMethod`.
pub payment_method: Option<Box<PaymentMethod>>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:energyPricingPolicy`.
pub energy_pricing_policy: Option<Box<egi::EnergyPricingPolicy>>,
/// XML element `fac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `fac:rateTableReference`.
pub rate_table_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:rateMatrixReference`.
pub rate_matrix_reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:_ratesByReferenceExtension`.
pub rates_by_reference_extension: Option<Box<Extension>>,
}
impl RatesByReference {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0a59, 0xa0a36, 0xa0809, 0xa05b0, 0xa0af5, 0xa0aec, 0xa05af];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01b3);
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa06e8 => { let v = r.string()?; e0.extend(v); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); r.set(&mut e1, v.map(Box::new), 2649); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0xa0809 => { let v = Some(egi::EnergyPricingPolicy::read(r)?); r.set(&mut e3, v.map(Box::new), 2057); }
0xa05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xa0af5 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e5, v.map(Box::new), 2805); }
0xa0aec => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e6, v.map(Box::new), 2796); }
0xa05af => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1455); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e5, 2805);
let v = Self {
applicable_currency: e0,
payment_method: e1,
overall_period: e2,
energy_pricing_policy: e3,
rates_extension: e4,
rate_table_reference: e5,
rate_matrix_reference: e6,
rates_by_reference_extension: e7,
};
r.close();
Ok(v)
}
}
impl RatesByReference {
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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "fac:overallPeriod", "", "")?; }
if let Some(v) = &self.energy_pricing_policy { v.write(w, "fac:energyPricingPolicy", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("fac:_ratesExtension", v)?; }
match &self.rate_table_reference {
Some(v) => { v.write(w, "fac:rateTableReference", "", " targetClass=\"fac:RateTable\"")?; }
None => return Err(w.missing("fac:rateTableReference")),
}
if let Some(v) = &self.rate_matrix_reference { v.write(w, "fac:rateMatrixReference", "", " targetClass=\"fac:RateMatrix\"")?; }
if let Some(v) = &self.rates_by_reference_extension { w.extension("fac:_ratesByReferenceExtension", v)?; }
w.end(tag)
}
}
impl RatesByReference {
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; 8];
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;
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); } } },
1548 => if r.first(&mut seen[1])? { f1 = PaymentMethod::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
676 => if r.first(&mut seen[3])? { f3 = egi::EnergyPricingPolicy::read_json(r)?.map(Box::new); },
804 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
1805 => if r.first(&mut seen[5])? { f5 = com::VersionedReference::read_json(r)?.map(Box::new); },
1796 => if r.first(&mut seen[6])? { f6 = com::VersionedReference::read_json(r)?.map(Box::new); },
803 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f5, 1805);
Ok(Self {
applicable_currency: f0,
payment_method: f1,
overall_period: f2,
energy_pricing_policy: f3,
rates_extension: f4,
rate_table_reference: f5,
rate_matrix_reference: f6,
rates_by_reference_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(415)?;
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_method {
w.key(1548)?;
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.energy_pricing_policy {
w.key(676)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(804)?;
w.extension(v)?;
}
match &self.rate_table_reference {
Some(v) => {
w.key(1805)?;
v.write_json(w, Some("RateTable"))?;
}
None => w.absent(1805, w.missing("rateTableReference"))?,
}
if let Some(v) = &self.rate_matrix_reference {
w.key(1796)?;
v.write_json(w, Some("RateMatrix"))?;
}
if let Some(v) = &self.rates_by_reference_extension {
w.key(803)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `fac:rateMatrix`.
pub rate_matrix: Vec<RateMatrix>,
/// XML element `fac:_ratesPublicationExtension`.
pub rates_publication_extension: Option<Box<Extension>>,
}
impl RatesPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0xa0893, 0xa0aeb, 0xa05b1];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01b4);
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); }
0xa0893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0xa0aeb => { let v = Some(RateMatrix::read(r)?); e6.extend(v); }
0xa05b1 => { 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, "fac:headerInformation", "", "")?; }
w.count("fac:rateMatrix", self.rate_matrix.len(), 1, usize::MAX)?;
for v in &self.rate_matrix { v.write(w, "fac:rateMatrix", "", "")?; }
if let Some(v) = &self.rates_publication_extension { w.extension("fac:_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); } } },
806 => 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(417)?;
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(806)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RelativeTimeRates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RelativeTimeRates {
/// XML attribute `collectionSequence`.
pub collection_sequence: Option<com::Integer>,
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Option<CurrencyCode>,
/// XML element `fac:minValueCollection`.
pub min_value_collection: Option<AmountOfMoney>,
/// XML element `fac:maxValueCollection`.
pub max_value_collection: Option<AmountOfMoney>,
/// XML element `fac:validStart`.
pub valid_start: Option<DateTime>,
/// XML element `fac:validEnd`.
pub valid_end: Option<DateTime>,
/// XML element `fac:minTime`.
pub min_time: Option<Duration>,
/// XML element `fac:maxTime`.
pub max_time: Option<Duration>,
/// XML element `fac:resetTime`.
pub reset_time: Option<Time>,
/// XML element `fac:taxIncluded`.
pub tax_included: Option<com::Boolean>,
/// XML element `fac:taxRate`.
pub tax_rate: Option<com::Percentage>,
/// XML element `fac:taxValue`.
pub tax_value: Option<AmountOfMoney>,
/// XML element `fac:relativeTimes`.
pub relative_times: Option<com::Boolean>,
/// XML element `fac:rateLine`.
pub rate_line: Vec<RateLine>,
/// XML element `fac:_rateLineCollectionExtension`.
pub rate_line_collection_extension: Option<Box<Extension>>,
/// XML element `fac:referenceTimeStart`.
pub reference_time_start: Option<DateTime>,
/// XML element `fac:referenceTimeEnd`.
pub reference_time_end: Option<DateTime>,
/// XML element `fac:_relativeTimeRatesExtension`.
pub relative_time_rates_extension: Option<Box<Extension>>,
}
impl RelativeTimeRates {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0976, 0xa0943, 0xa0c84, 0xa0c82, 0xa0974, 0xa0941, 0xa0b2f, 0xa0c00, 0xa0c01, 0xa0c02, 0xa0b1f, 0xa0ae7, 0xa05a8, 0xa0b05, 0xa0b04, 0xa05bb];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01bf);
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 {
0xa06e8 => { let v = r.string()?; r.set(&mut e0, v, 1768); }
0xa0976 => { let v = r.value::<Decimal>()?; r.set(&mut e1, v, 2422); }
0xa0943 => { let v = r.value::<Decimal>()?; r.set(&mut e2, v, 2371); }
0xa0c84 => { let v = r.date_time()?; r.set(&mut e3, v, 3204); }
0xa0c82 => { let v = r.date_time()?; r.set(&mut e4, v, 3202); }
0xa0974 => { let v = r.string()?; r.set(&mut e5, v, 2420); }
0xa0941 => { let v = r.string()?; r.set(&mut e6, v, 2369); }
0xa0b2f => { let v = r.value::<Time>()?; r.set(&mut e7, v, 2863); }
0xa0c00 => { let v = r.value::<bool>()?; r.set(&mut e8, v, 3072); }
0xa0c01 => { let v = r.value::<f32>()?; r.set(&mut e9, v, 3073); }
0xa0c02 => { let v = r.value::<Decimal>()?; r.set(&mut e10, v, 3074); }
0xa0b1f => { let v = r.value::<bool>()?; r.set(&mut e11, v, 2847); }
0xa0ae7 => { let v = Some(RateLine::read(r)?); e12.extend(v); }
0xa05a8 => { let v = r.raw()?; r.set(&mut e13, v.map(Box::new), 1448); }
0xa0b05 => { let v = r.date_time()?; r.set(&mut e14, v, 2821); }
0xa0b04 => { let v = r.date_time()?; r.set(&mut e15, v, 2820); }
0xa05bb => { 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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.min_value_collection { w.digits("minValueCollection", v, 8, 2)?; w.leaf("fac:minValueCollection", v)?; }
if let Some(v) = &self.max_value_collection { w.digits("maxValueCollection", v, 8, 2)?; w.leaf("fac:maxValueCollection", v)?; }
if let Some(v) = &self.valid_start { w.leaf("fac:validStart", v)?; }
if let Some(v) = &self.valid_end { w.leaf("fac:validEnd", v)?; }
if let Some(v) = &self.min_time { w.pattern("minTime", v, Pattern::Duration)?; w.leaf("fac:minTime", v)?; }
if let Some(v) = &self.max_time { w.pattern("maxTime", v, Pattern::Duration)?; w.leaf("fac:maxTime", v)?; }
if let Some(v) = &self.reset_time { w.leaf("fac:resetTime", v)?; }
if let Some(v) = &self.tax_included { w.leaf("fac:taxIncluded", v)?; }
if let Some(v) = &self.tax_rate { w.leaf("fac:taxRate", v)?; }
if let Some(v) = &self.tax_value { w.digits("taxValue", v, 8, 2)?; w.leaf("fac:taxValue", v)?; }
if let Some(v) = &self.relative_times { w.leaf("fac:relativeTimes", v)?; }
w.count("fac:rateLine", self.rate_line.len(), 1, usize::MAX)?;
for v in &self.rate_line { v.write(w, "fac:rateLine", "", "")?; }
if let Some(v) = &self.rate_line_collection_extension { w.extension("fac:_rateLineCollectionExtension", v)?; }
if let Some(v) = &self.reference_time_start { w.leaf("fac:referenceTimeStart", v)?; }
if let Some(v) = &self.reference_time_end { w.leaf("fac:referenceTimeEnd", v)?; }
if let Some(v) = &self.relative_time_rates_extension { w.extension("fac:_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); } } },
796 => 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()?; },
808 => 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(419)?;
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(796)?;
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(808)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:RightSpecification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RightSpecification {
/// XML element `fac:type`.
pub r#type: Option<RightTypeEnum>,
/// XML element `fac:description`.
pub description: Vec<MultilingualString>,
/// XML element `fac:expiry`.
pub expiry: Option<DateTime>,
/// XML element `fac:financialReference`.
pub financial_reference: Option<String>,
/// XML element `fac:issuer`.
pub issuer: Option<Box<com::VersionedReference>>,
/// XML element `fac:noFeeToUse`.
pub no_fee_to_use: Option<com::Boolean>,
/// XML element `fac:credential`.
pub credential: Vec<AnyCredential>,
/// XML element `fac:validity`.
pub validity: Option<Box<com::Validity>>,
/// XML element `fac:_rightSpecificationExtension`.
pub right_specification_extension: Option<Box<Extension>>,
}
impl RightSpecification {
const FIELDS: &'static [u32] = &[0xa0c5d, 0xa07a8, 0xa0836, 0xa085c, 0xa08dc, 0xa099e, 0xa077d, 0xa0c86, 0xa05c5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa01ca);
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 {
0xa0c5d => { let v = r.enumeration::<RightTypeEnum>()?; r.set(&mut e0, v, 3165); }
0xa07a8 => { let v = r.multilingual()?; e1.extend(v); }
0xa0836 => { let v = r.date_time()?; r.set(&mut e2, v, 2102); }
0xa085c => { let v = r.string()?; r.set(&mut e3, v, 2140); }
0xa08dc => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 2268); }
0xa099e => { let v = r.value::<bool>()?; r.set(&mut e5, v, 2462); }
0xa077d => { let v = AnyCredential::read(r)?; e6.extend(v); }
0xa0c86 => { let v = Some(com::Validity::read(r)?); r.set(&mut e7, v.map(Box::new), 3206); }
0xa05c5 => { 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 {
r#type: e0,
description: e1,
expiry: e2,
financial_reference: e3,
issuer: e4,
no_fee_to_use: 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)?;
if let Some(v) = &self.r#type { w.enumeration("fac:type", v.literal())?; }
for v in &self.description { w.multilingual("fac:description", v)?; }
if let Some(v) = &self.expiry { w.leaf("fac:expiry", v)?; }
if let Some(v) = &self.financial_reference { w.max_len("financialReference", v, 1024)?; w.leaf("fac:financialReference", v)?; }
if let Some(v) = &self.issuer { v.write(w, "fac:issuer", "", " targetClass=\"fac:Organisation\"")?; }
if let Some(v) = &self.no_fee_to_use { w.leaf("fac:noFeeToUse", v)?; }
for v in &self.credential { v.write(w, "fac:credential")?; }
if let Some(v) = &self.validity { v.write(w, "fac:validity", "", "")?; }
if let Some(v) = &self.right_specification_extension { w.extension("fac:_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; 9];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = Vec::new();
let mut f7 = None;
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 {
2495 => if r.first(&mut seen[0])? { f0 = r.enumeration::<RightTypeEnum>()?; },
545 => 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); } } },
728 => if r.first(&mut seen[2])? { f2 = r.date_time()?; },
850 => 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); },
1362 => if r.first(&mut seen[5])? { f5 = r.boolean()?; },
475 => if r.first(&mut seen[6])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyCredential::read_json(r)? { f6.push(v); } } },
2539 => if r.first(&mut seen[7])? { f7 = com::Validity::read_json(r)?.map(Box::new); },
809 => if r.first(&mut seen[8])? { f8 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
r#type: f0,
description: f1,
expiry: f2,
financial_reference: f3,
issuer: f4,
no_fee_to_use: f5,
credential: f6,
validity: f7,
right_specification_extension: f8,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(421)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.r#type {
w.key(2495)?;
w.enumeration(422, 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.expiry {
w.key(728)?;
w.date_time(v)?;
}
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("Organisation"))?;
}
if let Some(v) = &self.no_fee_to_use {
w.key(1362)?;
w.boolean(*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(809)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:alias`.
pub alias: Vec<MultilingualString>,
/// XML element `fac:externalIdentifier`.
pub external_identifier: Option<String>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:accessibility`.
pub accessibility: Vec<AccessibilityEnum>,
/// XML element `fac:additionalInformation`.
pub additional_information: Vec<MultilingualString>,
/// XML element `fac:informationWebsite`.
pub information_website: Vec<com::UrlLink>,
/// XML element `fac:photoUrl`.
pub photo_url: Vec<com::UrlLink>,
/// XML element `fac:photo`.
pub photo: Vec<Image>,
/// XML element `fac:operatingHours`.
pub operating_hours: Option<OperatingHours>,
/// XML element `fac:locationReference`.
pub location_reference: Option<loc::LocationReference>,
/// XML element `fac:owner`.
pub owner: Option<Organisation>,
/// XML element `fac:operator`.
pub operator: Option<Organisation>,
/// XML element `fac:associatedFacility`.
pub associated_facility: Vec<AnyAssociatedFacility>,
/// XML element `fac:rates`.
pub rates: Option<Rates>,
/// XML element `fac:applicableForVehicles`.
pub applicable_for_vehicles: Vec<com::VehicleCharacteristics>,
/// XML element `fac:dimension`.
pub dimension: Option<Box<Dimension>>,
/// XML element `fac:_facilityObjectExtension`.
pub facility_object_extension: Option<Box<Extension>>,
/// XML element `fac:availability`.
pub availability: Option<AvailabilityEnum>,
/// XML element `fac:quantity`.
pub quantity: Option<com::NonNegativeInteger>,
/// XML element `fac:regularlyCleaned`.
pub regularly_cleaned: Option<com::Boolean>,
/// XML element `fac:applicableForUser`.
pub applicable_for_user: Vec<UserTypeEnum>,
/// XML element `fac:_supplementalFacilityExtension`.
pub supplemental_facility_extension: Option<Box<Extension>>,
/// XML element `fac:equipmentType`.
pub equipment_type: Option<EquipmentTypeEnum>,
/// XML element `fac:_supplementalEquipmentExtension`.
pub supplemental_equipment_extension: Option<Box<Extension>>,
}
impl SupplementalEquipment {
const FIELDS: &'static [u32] = &[0xa098b, 0xa06d6, 0xa0840, 0xa08f8, 0xa07a8, 0xa0694, 0xa06b9, 0xa08c5, 0xa0a73, 0xa0a72, 0xa0a09, 0xa0926, 0xa0a3d, 0xa0a17, 0xa06fc, 0xa0af7, 0xa06ef, 0xa07b7, 0xa04b7, 0xa0705, 0xa0adf, 0xa0b15, 0xa06ee, 0xa0605, 0xa081f, 0xa0604];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa020b);
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 = 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 = Vec::new();
let mut e15 = None;
let mut e16 = Vec::new();
let mut e17 = None;
let mut e18 = None;
let mut e19 = None;
let mut e20 = None;
let mut e21 = None;
let mut e22 = Vec::new();
let mut e23 = None;
let mut e24 = None;
let mut e25 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0xa06d6 => { let v = r.multilingual()?; e1.extend(v); }
0xa0840 => { let v = r.string()?; r.set(&mut e2, v, 2112); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e3, v, 2296); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e4, v, 1960); }
0xa0694 => { let v = r.enumeration::<AccessibilityEnum>()?; e5.extend(v); }
0xa06b9 => { let v = r.multilingual()?; e6.extend(v); }
0xa08c5 => { let v = Some(com::UrlLink::read(r)?); e7.extend(v); }
0xa0a73 => { let v = Some(com::UrlLink::read(r)?); e8.extend(v); }
0xa0a72 => { let v = Some(Image::read(r)?); e9.extend(v); }
0xa0a09 => { let v = OperatingHours::read(r)?; r.set(&mut e10, v, 2569); }
0xa0926 => { let v = loc::LocationReference::read(r)?; r.set(&mut e11, v, 2342); }
0xa0a3d => { let v = Organisation::read(r)?; r.set(&mut e12, v, 2621); }
0xa0a17 => { let v = Organisation::read(r)?; r.set(&mut e13, v, 2583); }
0xa06fc => { let v = AnyAssociatedFacility::read(r)?; e14.extend(v); }
0xa0af7 => { let v = Rates::read(r)?; r.set(&mut e15, v, 2807); }
0xa06ef => { let v = Some(com::VehicleCharacteristics::read(r)?); e16.extend(v); }
0xa07b7 => { let v = Some(Dimension::read(r)?); r.set(&mut e17, v.map(Box::new), 1975); }
0xa04b7 => { let v = r.raw()?; r.set(&mut e18, v.map(Box::new), 1207); }
0xa0705 => { let v = r.enumeration::<AvailabilityEnum>()?; r.set(&mut e19, v, 1797); }
0xa0adf => { let v = r.value::<u64>()?; r.set(&mut e20, v, 2783); }
0xa0b15 => { let v = r.value::<bool>()?; r.set(&mut e21, v, 2837); }
0xa06ee => { let v = r.enumeration::<UserTypeEnum>()?; e22.extend(v); }
0xa0605 => { let v = r.raw()?; r.set(&mut e23, v.map(Box::new), 1541); }
0xa081f => { let v = r.enumeration::<EquipmentTypeEnum>()?; r.set(&mut e24, v, 2079); }
0xa0604 => { let v = r.raw()?; r.set(&mut e25, v.map(Box::new), 1540); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e24, 2079);
let v = Self {
id: a0,
version: a1,
name: e0,
alias: e1,
external_identifier: e2,
last_updated: e3,
description: e4,
accessibility: e5,
additional_information: e6,
information_website: e7,
photo_url: e8,
photo: e9,
operating_hours: e10,
location_reference: e11,
owner: e12,
operator: e13,
associated_facility: e14,
rates: e15,
applicable_for_vehicles: e16,
dimension: e17,
facility_object_extension: e18,
availability: e19,
quantity: e20,
regularly_cleaned: e21,
applicable_for_user: e22,
supplemental_facility_extension: e23,
equipment_type: e24,
supplemental_equipment_extension: e25,
};
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("fac:name", v)?; }
for v in &self.alias { w.multilingual("fac:alias", v)?; }
if let Some(v) = &self.external_identifier { w.max_len("externalIdentifier", v, 1024)?; w.leaf("fac:externalIdentifier", v)?; }
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
for v in &self.accessibility { w.enumeration("fac:accessibility", v.literal())?; }
for v in &self.additional_information { w.multilingual("fac:additionalInformation", v)?; }
for v in &self.information_website { v.write(w, "fac:informationWebsite", "", "")?; }
for v in &self.photo_url { v.write(w, "fac:photoUrl", "", "")?; }
for v in &self.photo { v.write(w, "fac:photo", "", "")?; }
if let Some(v) = &self.operating_hours { v.write(w, "fac:operatingHours")?; }
if let Some(v) = &self.location_reference { v.write(w, "fac:locationReference")?; }
if let Some(v) = &self.owner { v.write(w, "fac:owner")?; }
if let Some(v) = &self.operator { v.write(w, "fac:operator")?; }
for v in &self.associated_facility { v.write(w, "fac:associatedFacility")?; }
if let Some(v) = &self.rates { v.write(w, "fac:rates")?; }
for v in &self.applicable_for_vehicles { v.write(w, "fac:applicableForVehicles", "", "")?; }
if let Some(v) = &self.dimension { v.write(w, "fac:dimension", "", "")?; }
if let Some(v) = &self.facility_object_extension { w.extension("fac:_facilityObjectExtension", v)?; }
if let Some(v) = &self.availability { w.enumeration("fac:availability", v.literal())?; }
if let Some(v) = &self.quantity { w.leaf("fac:quantity", v)?; }
if let Some(v) = &self.regularly_cleaned { w.leaf("fac:regularlyCleaned", v)?; }
for v in &self.applicable_for_user { w.enumeration("fac:applicableForUser", v.literal())?; }
if let Some(v) = &self.supplemental_facility_extension { w.extension("fac:_supplementalFacilityExtension", v)?; }
match &self.equipment_type {
Some(v) => { w.enumeration("fac:equipmentType", v.literal())?; }
None => return Err(w.missing("fac:equipmentType")),
}
if let Some(v) = &self.supplemental_equipment_extension { w.extension("fac:_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; 28];
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 = 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 = Vec::new();
let mut f17 = None;
let mut f18 = Vec::new();
let mut f19 = None;
let mut f20 = None;
let mut f21 = None;
let mut f22 = None;
let mut f23 = None;
let mut f24 = Vec::new();
let mut f25 = None;
let mut f26 = None;
let mut f27 = 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); } } },
739 => if r.first(&mut seen[4])? { f4 = r.string()?; },
1043 => if r.first(&mut seen[5])? { f5 = r.date_time()?; },
545 => if r.first(&mut seen[6])? { f6 = r.multilingual()?; },
25 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<AccessibilityEnum>()? { f7.push(v); } } },
61 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { 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)?; },
263 => if r.first(&mut seen[16])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyAssociatedFacility::read_json(r)? { f16.push(v); } } },
1807 => if r.first(&mut seen[17])? { f17 = Rates::read_json(r)?; },
250 => if r.first(&mut seen[18])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::VehicleCharacteristics::read_json(r)? { f18.push(v); } } },
560 => if r.first(&mut seen[19])? { f19 = Dimension::read_json(r)?.map(Box::new); },
764 => if r.first(&mut seen[20])? { f20 = r.raw_object()?.map(Box::new); },
272 => if r.first(&mut seen[21])? { f21 = r.enumeration::<AvailabilityEnum>()?; },
1783 => if r.first(&mut seen[22])? { f22 = r.number::<u64>()?; },
1837 => if r.first(&mut seen[23])? { f23 = r.boolean()?; },
249 => if r.first(&mut seen[24])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<UserTypeEnum>()? { f24.push(v); } } },
812 => if r.first(&mut seen[25])? { f25 = r.raw_object()?.map(Box::new); },
698 => if r.first(&mut seen[26])? { f26 = r.enumeration::<EquipmentTypeEnum>()?; },
811 => if r.first(&mut seen[27])? { f27 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f26, 698);
Ok(Self {
id: f0,
version: f1,
name: f2,
alias: f3,
external_identifier: f4,
last_updated: f5,
description: f6,
accessibility: f7,
additional_information: f8,
information_website: f9,
photo_url: f10,
photo: f11,
operating_hours: f12,
location_reference: f13,
owner: f14,
operator: f15,
associated_facility: f16,
rates: f17,
applicable_for_vehicles: f18,
dimension: f19,
facility_object_extension: f20,
availability: f21,
quantity: f22,
regularly_cleaned: f23,
applicable_for_user: f24,
supplemental_facility_extension: f25,
equipment_type: f26,
supplemental_equipment_extension: f27,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(424)?;
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.external_identifier {
w.key(739)?;
w.max_len("externalIdentifier", v, 1024)?; w.string(v)?;
}
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(356, 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.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 !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.facility_object_extension {
w.key(764)?;
w.extension(v)?;
}
if let Some(v) = &self.availability {
w.key(272)?;
w.enumeration(360, 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(437, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.supplemental_facility_extension {
w.key(812)?;
w.extension(v)?;
}
match &self.equipment_type {
Some(v) => {
w.key(698)?;
w.enumeration(375, v.literal())?;
}
None => w.absent(698, w.missing("equipmentType"))?,
}
if let Some(v) = &self.supplemental_equipment_extension {
w.key(811)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:SupplementalFacilityStatus`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SupplementalFacilityStatus {
/// XML element `fac:reference`.
pub reference: Option<Box<com::VersionedReference>>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:openingStatus`.
pub opening_status: Option<OpeningStatusEnum>,
/// XML element `fac:regularOperatingHoursInForce`.
pub regular_operating_hours_in_force: Option<com::Boolean>,
/// XML element `fac:statusDescription`.
pub status_description: Option<MultilingualString>,
/// XML element `fac:newOperatingHours`.
pub new_operating_hours: Option<OperatingHours>,
/// XML element `fac:newRates`.
pub new_rates: Option<Rates>,
/// XML element `fac:fault`.
pub fault: Option<com::AnyFault>,
/// XML element `fac:_facilityObjectStatusExtension`.
pub facility_object_status_extension: Option<Box<Extension>>,
/// XML element `fac:quantityOverride`.
pub quantity_override: Option<com::NonNegativeInteger>,
/// XML element `fac:numberOfSubitemsOverride`.
pub number_of_subitems_override: Option<com::NonNegativeInteger>,
/// XML element `fac:vacantSubitems`.
pub vacant_subitems: Option<com::NonNegativeInteger>,
/// XML element `fac:equipmentOperationStatus`.
pub equipment_operation_status: Option<OperationStatusEnum>,
/// XML element `fac:_supplementalFacilityStatusExtension`.
pub supplemental_facility_status_extension: Option<Box<Extension>>,
}
impl SupplementalFacilityStatus {
const FIELDS: &'static [u32] = &[0xa0b01, 0xa08f8, 0xa09ec, 0xa0b13, 0xa0bd2, 0xa099a, 0xa099b, 0xa0849, 0xa04b8, 0xa0ae0, 0xa09c9, 0xa0c81, 0xa081d, 0xa0606];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa020d);
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0b01 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2817); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e1, v, 2296); }
0xa09ec => { let v = r.enumeration::<OpeningStatusEnum>()?; r.set(&mut e2, v, 2540); }
0xa0b13 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2835); }
0xa0bd2 => { let v = r.multilingual()?; r.set(&mut e4, v, 3026); }
0xa099a => { let v = OperatingHours::read(r)?; r.set(&mut e5, v, 2458); }
0xa099b => { let v = Rates::read(r)?; r.set(&mut e6, v, 2459); }
0xa0849 => { let v = com::AnyFault::read(r)?; r.set(&mut e7, v, 2121); }
0xa04b8 => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1208); }
0xa0ae0 => { let v = r.value::<u64>()?; r.set(&mut e9, v, 2784); }
0xa09c9 => { let v = r.value::<u64>()?; r.set(&mut e10, v, 2505); }
0xa0c81 => { let v = r.value::<u64>()?; r.set(&mut e11, v, 3201); }
0xa081d => { let v = r.enumeration::<OperationStatusEnum>()?; r.set(&mut e12, v, 2077); }
0xa0606 => { let v = r.raw()?; r.set(&mut e13, 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,
regular_operating_hours_in_force: e3,
status_description: e4,
new_operating_hours: e5,
new_rates: e6,
fault: e7,
facility_object_status_extension: e8,
quantity_override: e9,
number_of_subitems_override: e10,
vacant_subitems: e11,
equipment_operation_status: e12,
supplemental_facility_status_extension: e13,
};
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, "fac:reference", "", " targetClass=\"fac:FacilityObject\"")?; }
None => return Err(w.missing("fac:reference")),
}
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.opening_status { w.enumeration("fac:openingStatus", v.literal())?; }
if let Some(v) = &self.regular_operating_hours_in_force { w.leaf("fac:regularOperatingHoursInForce", v)?; }
if let Some(v) = &self.status_description { w.multilingual("fac:statusDescription", v)?; }
if let Some(v) = &self.new_operating_hours { v.write(w, "fac:newOperatingHours")?; }
if let Some(v) = &self.new_rates { v.write(w, "fac:newRates")?; }
if let Some(v) = &self.fault { v.write(w, "fac:fault")?; }
if let Some(v) = &self.facility_object_status_extension { w.extension("fac:_facilityObjectStatusExtension", v)?; }
if let Some(v) = &self.quantity_override { w.leaf("fac:quantityOverride", v)?; }
if let Some(v) = &self.number_of_subitems_override { w.leaf("fac:numberOfSubitemsOverride", v)?; }
if let Some(v) = &self.vacant_subitems { w.leaf("fac:vacantSubitems", v)?; }
if let Some(v) = &self.equipment_operation_status { w.enumeration("fac:equipmentOperationStatus", v.literal())?; }
if let Some(v) = &self.supplemental_facility_status_extension { w.extension("fac:_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; 14];
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;
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>()?; },
1835 => if r.first(&mut seen[3])? { f3 = r.boolean()?; },
2191 => if r.first(&mut seen[4])? { f4 = r.multilingual()?; },
1358 => if r.first(&mut seen[5])? { f5 = OperatingHours::read_json(r)?; },
1359 => if r.first(&mut seen[6])? { f6 = Rates::read_json(r)?; },
831 => if r.first(&mut seen[7])? { f7 = com::AnyFault::read_json(r)?; },
765 => if r.first(&mut seen[8])? { f8 = r.raw_object()?.map(Box::new); },
1784 => if r.first(&mut seen[9])? { f9 = r.number::<u64>()?; },
1405 => if r.first(&mut seen[10])? { f10 = r.number::<u64>()?; },
2534 => if r.first(&mut seen[11])? { f11 = r.number::<u64>()?; },
696 => if r.first(&mut seen[12])? { f12 = r.enumeration::<OperationStatusEnum>()?; },
813 => if r.first(&mut seen[13])? { f13 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1817);
Ok(Self {
reference: f0,
last_updated: f1,
opening_status: f2,
regular_operating_hours_in_force: f3,
status_description: f4,
new_operating_hours: f5,
new_rates: f6,
fault: f7,
facility_object_status_extension: f8,
quantity_override: f9,
number_of_subitems_override: f10,
vacant_subitems: f11,
equipment_operation_status: f12,
supplemental_facility_status_extension: f13,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(426)?;
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(385, 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(765)?;
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(391, v.literal())?;
}
if let Some(v) = &self.supplemental_facility_status_extension {
w.key(813)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac: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 `fac:name`.
pub name: Option<MultilingualString>,
/// XML element `fac:alias`.
pub alias: Vec<MultilingualString>,
/// XML element `fac:externalIdentifier`.
pub external_identifier: Option<String>,
/// XML element `fac:lastUpdated`.
pub last_updated: Option<DateTime>,
/// XML element `fac:description`.
pub description: Option<MultilingualString>,
/// XML element `fac:accessibility`.
pub accessibility: Vec<AccessibilityEnum>,
/// XML element `fac:additionalInformation`.
pub additional_information: Vec<MultilingualString>,
/// XML element `fac:informationWebsite`.
pub information_website: Vec<com::UrlLink>,
/// XML element `fac:photoUrl`.
pub photo_url: Vec<com::UrlLink>,
/// XML element `fac:photo`.
pub photo: Vec<Image>,
/// XML element `fac:operatingHours`.
pub operating_hours: Option<OperatingHours>,
/// XML element `fac:locationReference`.
pub location_reference: Option<loc::LocationReference>,
/// XML element `fac:owner`.
pub owner: Option<Organisation>,
/// XML element `fac:operator`.
pub operator: Option<Organisation>,
/// XML element `fac:associatedFacility`.
pub associated_facility: Vec<AnyAssociatedFacility>,
/// XML element `fac:rates`.
pub rates: Option<Rates>,
/// XML element `fac:applicableForVehicles`.
pub applicable_for_vehicles: Vec<com::VehicleCharacteristics>,
/// XML element `fac:dimension`.
pub dimension: Option<Box<Dimension>>,
/// XML element `fac:_facilityObjectExtension`.
pub facility_object_extension: Option<Box<Extension>>,
/// XML element `fac:availability`.
pub availability: Option<AvailabilityEnum>,
/// XML element `fac:quantity`.
pub quantity: Option<com::NonNegativeInteger>,
/// XML element `fac:regularlyCleaned`.
pub regularly_cleaned: Option<com::Boolean>,
/// XML element `fac:applicableForUser`.
pub applicable_for_user: Vec<UserTypeEnum>,
/// XML element `fac:_supplementalFacilityExtension`.
pub supplemental_facility_extension: Option<Box<Extension>>,
/// XML element `fac:serviceFacilityType`.
pub service_facility_type: Option<ServiceFacilityTypeEnum>,
/// XML element `fac:numberOfSubitems`.
pub number_of_subitems: Option<com::NonNegativeInteger>,
/// XML element `fac:distanceFromOriginFacility`.
pub distance_from_origin_facility: Option<com::MetresAsNonNegativeInteger>,
/// XML element `fac:_supplementalServiceFacilityExtension`.
pub supplemental_service_facility_extension: Option<Box<Extension>>,
}
impl SupplementalServiceFacility {
const FIELDS: &'static [u32] = &[0xa098b, 0xa06d6, 0xa0840, 0xa08f8, 0xa07a8, 0xa0694, 0xa06b9, 0xa08c5, 0xa0a73, 0xa0a72, 0xa0a09, 0xa0926, 0xa0a3d, 0xa0a17, 0xa06fc, 0xa0af7, 0xa06ef, 0xa07b7, 0xa04b7, 0xa0705, 0xa0adf, 0xa0b15, 0xa06ee, 0xa0605, 0xa0b80, 0xa09c8, 0xa07d2, 0xa0607];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa020e);
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 = 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 = Vec::new();
let mut e15 = None;
let mut e16 = Vec::new();
let mut e17 = None;
let mut e18 = None;
let mut e19 = None;
let mut e20 = None;
let mut e21 = None;
let mut e22 = Vec::new();
let mut e23 = None;
let mut e24 = None;
let mut e25 = None;
let mut e26 = None;
let mut e27 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa098b => { let v = r.multilingual()?; r.set(&mut e0, v, 2443); }
0xa06d6 => { let v = r.multilingual()?; e1.extend(v); }
0xa0840 => { let v = r.string()?; r.set(&mut e2, v, 2112); }
0xa08f8 => { let v = r.date_time()?; r.set(&mut e3, v, 2296); }
0xa07a8 => { let v = r.multilingual()?; r.set(&mut e4, v, 1960); }
0xa0694 => { let v = r.enumeration::<AccessibilityEnum>()?; e5.extend(v); }
0xa06b9 => { let v = r.multilingual()?; e6.extend(v); }
0xa08c5 => { let v = Some(com::UrlLink::read(r)?); e7.extend(v); }
0xa0a73 => { let v = Some(com::UrlLink::read(r)?); e8.extend(v); }
0xa0a72 => { let v = Some(Image::read(r)?); e9.extend(v); }
0xa0a09 => { let v = OperatingHours::read(r)?; r.set(&mut e10, v, 2569); }
0xa0926 => { let v = loc::LocationReference::read(r)?; r.set(&mut e11, v, 2342); }
0xa0a3d => { let v = Organisation::read(r)?; r.set(&mut e12, v, 2621); }
0xa0a17 => { let v = Organisation::read(r)?; r.set(&mut e13, v, 2583); }
0xa06fc => { let v = AnyAssociatedFacility::read(r)?; e14.extend(v); }
0xa0af7 => { let v = Rates::read(r)?; r.set(&mut e15, v, 2807); }
0xa06ef => { let v = Some(com::VehicleCharacteristics::read(r)?); e16.extend(v); }
0xa07b7 => { let v = Some(Dimension::read(r)?); r.set(&mut e17, v.map(Box::new), 1975); }
0xa04b7 => { let v = r.raw()?; r.set(&mut e18, v.map(Box::new), 1207); }
0xa0705 => { let v = r.enumeration::<AvailabilityEnum>()?; r.set(&mut e19, v, 1797); }
0xa0adf => { let v = r.value::<u64>()?; r.set(&mut e20, v, 2783); }
0xa0b15 => { let v = r.value::<bool>()?; r.set(&mut e21, v, 2837); }
0xa06ee => { let v = r.enumeration::<UserTypeEnum>()?; e22.extend(v); }
0xa0605 => { let v = r.raw()?; r.set(&mut e23, v.map(Box::new), 1541); }
0xa0b80 => { let v = r.enumeration::<ServiceFacilityTypeEnum>()?; r.set(&mut e24, v, 2944); }
0xa09c8 => { let v = r.value::<u64>()?; r.set(&mut e25, v, 2504); }
0xa07d2 => { let v = r.value::<u64>()?; r.set(&mut e26, v, 2002); }
0xa0607 => { let v = r.raw()?; r.set(&mut e27, v.map(Box::new), 1543); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e24, 2944);
let v = Self {
id: a0,
version: a1,
name: e0,
alias: e1,
external_identifier: e2,
last_updated: e3,
description: e4,
accessibility: e5,
additional_information: e6,
information_website: e7,
photo_url: e8,
photo: e9,
operating_hours: e10,
location_reference: e11,
owner: e12,
operator: e13,
associated_facility: e14,
rates: e15,
applicable_for_vehicles: e16,
dimension: e17,
facility_object_extension: e18,
availability: e19,
quantity: e20,
regularly_cleaned: e21,
applicable_for_user: e22,
supplemental_facility_extension: e23,
service_facility_type: e24,
number_of_subitems: e25,
distance_from_origin_facility: e26,
supplemental_service_facility_extension: e27,
};
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("fac:name", v)?; }
for v in &self.alias { w.multilingual("fac:alias", v)?; }
if let Some(v) = &self.external_identifier { w.max_len("externalIdentifier", v, 1024)?; w.leaf("fac:externalIdentifier", v)?; }
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
for v in &self.accessibility { w.enumeration("fac:accessibility", v.literal())?; }
for v in &self.additional_information { w.multilingual("fac:additionalInformation", v)?; }
for v in &self.information_website { v.write(w, "fac:informationWebsite", "", "")?; }
for v in &self.photo_url { v.write(w, "fac:photoUrl", "", "")?; }
for v in &self.photo { v.write(w, "fac:photo", "", "")?; }
if let Some(v) = &self.operating_hours { v.write(w, "fac:operatingHours")?; }
if let Some(v) = &self.location_reference { v.write(w, "fac:locationReference")?; }
if let Some(v) = &self.owner { v.write(w, "fac:owner")?; }
if let Some(v) = &self.operator { v.write(w, "fac:operator")?; }
for v in &self.associated_facility { v.write(w, "fac:associatedFacility")?; }
if let Some(v) = &self.rates { v.write(w, "fac:rates")?; }
for v in &self.applicable_for_vehicles { v.write(w, "fac:applicableForVehicles", "", "")?; }
if let Some(v) = &self.dimension { v.write(w, "fac:dimension", "", "")?; }
if let Some(v) = &self.facility_object_extension { w.extension("fac:_facilityObjectExtension", v)?; }
if let Some(v) = &self.availability { w.enumeration("fac:availability", v.literal())?; }
if let Some(v) = &self.quantity { w.leaf("fac:quantity", v)?; }
if let Some(v) = &self.regularly_cleaned { w.leaf("fac:regularlyCleaned", v)?; }
for v in &self.applicable_for_user { w.enumeration("fac:applicableForUser", v.literal())?; }
if let Some(v) = &self.supplemental_facility_extension { w.extension("fac:_supplementalFacilityExtension", v)?; }
match &self.service_facility_type {
Some(v) => { w.enumeration("fac:serviceFacilityType", v.literal())?; }
None => return Err(w.missing("fac:serviceFacilityType")),
}
if let Some(v) = &self.number_of_subitems { w.leaf("fac:numberOfSubitems", v)?; }
if let Some(v) = &self.distance_from_origin_facility { w.leaf("fac:distanceFromOriginFacility", v)?; }
if let Some(v) = &self.supplemental_service_facility_extension { w.extension("fac:_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; 30];
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 = 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 = Vec::new();
let mut f17 = None;
let mut f18 = Vec::new();
let mut f19 = None;
let mut f20 = None;
let mut f21 = None;
let mut f22 = None;
let mut f23 = None;
let mut f24 = Vec::new();
let mut f25 = None;
let mut f26 = None;
let mut f27 = None;
let mut f28 = None;
let mut f29 = 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); } } },
739 => if r.first(&mut seen[4])? { f4 = r.string()?; },
1043 => if r.first(&mut seen[5])? { f5 = r.date_time()?; },
545 => if r.first(&mut seen[6])? { f6 = r.multilingual()?; },
25 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<AccessibilityEnum>()? { f7.push(v); } } },
61 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.multilingual()? { 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)?; },
263 => if r.first(&mut seen[16])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyAssociatedFacility::read_json(r)? { f16.push(v); } } },
1807 => if r.first(&mut seen[17])? { f17 = Rates::read_json(r)?; },
250 => if r.first(&mut seen[18])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = com::VehicleCharacteristics::read_json(r)? { f18.push(v); } } },
560 => if r.first(&mut seen[19])? { f19 = Dimension::read_json(r)?.map(Box::new); },
764 => if r.first(&mut seen[20])? { f20 = r.raw_object()?.map(Box::new); },
272 => if r.first(&mut seen[21])? { f21 = r.enumeration::<AvailabilityEnum>()?; },
1783 => if r.first(&mut seen[22])? { f22 = r.number::<u64>()?; },
1837 => if r.first(&mut seen[23])? { f23 = r.boolean()?; },
249 => if r.first(&mut seen[24])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<UserTypeEnum>()? { f24.push(v); } } },
812 => if r.first(&mut seen[25])? { f25 = r.raw_object()?.map(Box::new); },
2031 => if r.first(&mut seen[26])? { f26 = r.enumeration::<ServiceFacilityTypeEnum>()?; },
1404 => if r.first(&mut seen[27])? { f27 = r.number::<u64>()?; },
587 => if r.first(&mut seen[28])? { f28 = r.number::<u64>()?; },
815 => if r.first(&mut seen[29])? { f29 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f26, 2031);
Ok(Self {
id: f0,
version: f1,
name: f2,
alias: f3,
external_identifier: f4,
last_updated: f5,
description: f6,
accessibility: f7,
additional_information: f8,
information_website: f9,
photo_url: f10,
photo: f11,
operating_hours: f12,
location_reference: f13,
owner: f14,
operator: f15,
associated_facility: f16,
rates: f17,
applicable_for_vehicles: f18,
dimension: f19,
facility_object_extension: f20,
availability: f21,
quantity: f22,
regularly_cleaned: f23,
applicable_for_user: f24,
supplemental_facility_extension: f25,
service_facility_type: f26,
number_of_subitems: f27,
distance_from_origin_facility: f28,
supplemental_service_facility_extension: f29,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(427)?;
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.external_identifier {
w.key(739)?;
w.max_len("externalIdentifier", v, 1024)?; w.string(v)?;
}
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(356, 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.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 !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.facility_object_extension {
w.key(764)?;
w.extension(v)?;
}
if let Some(v) = &self.availability {
w.key(272)?;
w.enumeration(360, 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(437, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.supplemental_facility_extension {
w.key(812)?;
w.extension(v)?;
}
match &self.service_facility_type {
Some(v) => {
w.key(2031)?;
w.enumeration(423, 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(815)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:Surcharge`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Surcharge {
/// XML element `fac:surchargeType`.
pub surcharge_type: Option<SurchargeTypeEnum>,
/// XML element `fac:value`.
pub value: Option<AmountOfMoney>,
/// XML element `fac:rate`.
pub rate: Option<com::Percentage>,
/// XML element `fac:trigger`.
pub trigger: Option<MultilingualString>,
/// XML element `fac:refund`.
pub refund: Option<RefundTypeEnum>,
/// XML element `fac:labelForDisplay`.
pub label_for_display: Option<MultilingualString>,
/// XML element `fac:_surchargeExtension`.
pub surcharge_extension: Option<Box<Extension>>,
}
impl Surcharge {
const FIELDS: &'static [u32] = &[0xa0bf8, 0xa0c8c, 0xa0ae4, 0xa0c57, 0xa0b11, 0xa08e8, 0xa060f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0217);
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 {
0xa0bf8 => { let v = r.enumeration::<SurchargeTypeEnum>()?; r.set(&mut e0, v, 3064); }
0xa0c8c => { let v = r.value::<Decimal>()?; r.set(&mut e1, v, 3212); }
0xa0ae4 => { let v = r.value::<f32>()?; r.set(&mut e2, v, 2788); }
0xa0c57 => { let v = r.multilingual()?; r.set(&mut e3, v, 3159); }
0xa0b11 => { let v = r.enumeration::<RefundTypeEnum>()?; r.set(&mut e4, v, 2833); }
0xa08e8 => { let v = r.multilingual()?; r.set(&mut e5, v, 2280); }
0xa060f => { 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("fac:surchargeType", v.literal())?; }
None => return Err(w.missing("fac:surchargeType")),
}
if let Some(v) = &self.value { w.digits("value", v, 8, 2)?; w.leaf("fac:value", v)?; }
if let Some(v) = &self.rate { w.leaf("fac:rate", v)?; }
if let Some(v) = &self.trigger { w.multilingual("fac:trigger", v)?; }
if let Some(v) = &self.refund { w.enumeration("fac:refund", v.literal())?; }
if let Some(v) = &self.label_for_display { w.multilingual("fac:labelForDisplay", v)?; }
if let Some(v) = &self.surcharge_extension { w.extension("fac:_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()?; },
816 => 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(428)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.surcharge_type {
Some(v) => {
w.key(2227)?;
w.enumeration(429, 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(418, 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(816)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UndefinedOperatingHours`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UndefinedOperatingHours {
/// XML element `fac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `fac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `fac:_undefinedOperatingHoursExtension`.
pub undefined_operating_hours_extension: Option<Box<Extension>>,
}
impl UndefinedOperatingHours {
const FIELDS: &'static [u32] = &[0xa074a, 0xa054d, 0xa0653];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa025b);
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 {
0xa074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0xa054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0xa0653 => { 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, "fac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("fac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.undefined_operating_hours_extension { w.extension("fac:_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); },
776 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
818 => 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(430)?;
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(776)?;
w.extension(v)?;
}
if let Some(v) = &self.undefined_operating_hours_extension {
w.key(818)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UndefinedOrganisation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UndefinedOrganisation {
/// XML element `fac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `fac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `fac:_undefinedOrganisationExtension`.
pub undefined_organisation_extension: Option<Box<Extension>>,
}
impl UndefinedOrganisation {
const FIELDS: &'static [u32] = &[0xa087b, 0xa055a, 0xa0654];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa025c);
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 {
0xa087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0xa055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0xa0654 => { 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, "fac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("fac:_organisationExtension", v)?; }
if let Some(v) = &self.undefined_organisation_extension { w.extension("fac:_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); },
784 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
820 => 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(431)?;
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(784)?;
w.extension(v)?;
}
if let Some(v) = &self.undefined_organisation_extension {
w.key(820)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UnknownOperatingHours`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnknownOperatingHours {
/// XML element `fac:closureInformation`.
pub closure_information: Option<Box<ClosureInformation>>,
/// XML element `fac:_operatingHoursExtension`.
pub operating_hours_extension: Option<Box<Extension>>,
/// XML element `fac:_unknownOperatingHoursExtension`.
pub unknown_operating_hours_extension: Option<Box<Extension>>,
}
impl UnknownOperatingHours {
const FIELDS: &'static [u32] = &[0xa074a, 0xa054d, 0xa0655];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa025d);
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 {
0xa074a => { let v = Some(ClosureInformation::read(r)?); r.set(&mut e0, v.map(Box::new), 1866); }
0xa054d => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1357); }
0xa0655 => { 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, "fac:closureInformation", "", "")?; }
if let Some(v) = &self.operating_hours_extension { w.extension("fac:_operatingHoursExtension", v)?; }
if let Some(v) = &self.unknown_operating_hours_extension { w.extension("fac:_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); },
776 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
822 => 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(432)?;
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(776)?;
w.extension(v)?;
}
if let Some(v) = &self.unknown_operating_hours_extension {
w.key(822)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UnknownOrganisation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnknownOrganisation {
/// XML element `fac:generalTimeValidity`.
pub general_time_validity: Option<Box<com::OverallPeriod>>,
/// XML element `fac:_organisationExtension`.
pub organisation_extension: Option<Box<Extension>>,
/// XML element `fac:_unknownOrganisationExtension`.
pub unknown_organisation_extension: Option<Box<Extension>>,
}
impl UnknownOrganisation {
const FIELDS: &'static [u32] = &[0xa087b, 0xa055a, 0xa0656];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa025e);
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 {
0xa087b => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e0, v.map(Box::new), 2171); }
0xa055a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1370); }
0xa0656 => { 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, "fac:generalTimeValidity", "", "")?; }
if let Some(v) = &self.organisation_extension { w.extension("fac:_organisationExtension", v)?; }
if let Some(v) = &self.unknown_organisation_extension { w.extension("fac:_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); },
784 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
824 => 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(433)?;
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(784)?;
w.extension(v)?;
}
if let Some(v) = &self.unknown_organisation_extension {
w.key(824)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UnknownRates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnknownRates {
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `fac:paymentMethod`.
pub payment_method: Option<Box<PaymentMethod>>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:energyPricingPolicy`.
pub energy_pricing_policy: Option<Box<egi::EnergyPricingPolicy>>,
/// XML element `fac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `fac:_unknownRatesExtension`.
pub unknown_rates_extension: Option<Box<Extension>>,
}
impl UnknownRates {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0a59, 0xa0a36, 0xa0809, 0xa05b0, 0xa0657];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa025f);
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 {
0xa06e8 => { let v = r.string()?; e0.extend(v); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); r.set(&mut e1, v.map(Box::new), 2649); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0xa0809 => { let v = Some(egi::EnergyPricingPolicy::read(r)?); r.set(&mut e3, v.map(Box::new), 2057); }
0xa05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xa0657 => { let v = r.raw()?; r.set(&mut e5, 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_method: e1,
overall_period: e2,
energy_pricing_policy: e3,
rates_extension: e4,
unknown_rates_extension: e5,
};
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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "fac:overallPeriod", "", "")?; }
if let Some(v) = &self.energy_pricing_policy { v.write(w, "fac:energyPricingPolicy", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("fac:_ratesExtension", v)?; }
if let Some(v) = &self.unknown_rates_extension { w.extension("fac:_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; 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); } } },
1548 => if r.first(&mut seen[1])? { f1 = PaymentMethod::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
676 => if r.first(&mut seen[3])? { f3 = egi::EnergyPricingPolicy::read_json(r)?.map(Box::new); },
804 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
826 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment_method: f1,
overall_period: f2,
energy_pricing_policy: f3,
rates_extension: f4,
unknown_rates_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(434)?;
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_method {
w.key(1548)?;
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.energy_pricing_policy {
w.key(676)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(804)?;
w.extension(v)?;
}
if let Some(v) = &self.unknown_rates_extension {
w.key(826)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UnspecifiedRates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UnspecifiedRates {
/// XML element `fac:applicableCurrency`.
pub applicable_currency: Vec<CurrencyCode>,
/// XML element `fac:paymentMethod`.
pub payment_method: Option<Box<PaymentMethod>>,
/// XML element `fac:overallPeriod`.
pub overall_period: Option<Box<com::OverallPeriod>>,
/// XML element `fac:energyPricingPolicy`.
pub energy_pricing_policy: Option<Box<egi::EnergyPricingPolicy>>,
/// XML element `fac:_ratesExtension`.
pub rates_extension: Option<Box<Extension>>,
/// XML element `fac:_unspecifiedRatesExtension`.
pub unspecified_rates_extension: Option<Box<Extension>>,
}
impl UnspecifiedRates {
const FIELDS: &'static [u32] = &[0xa06e8, 0xa0a59, 0xa0a36, 0xa0809, 0xa05b0, 0xa0658];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0260);
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 {
0xa06e8 => { let v = r.string()?; e0.extend(v); }
0xa0a59 => { let v = Some(PaymentMethod::read(r)?); r.set(&mut e1, v.map(Box::new), 2649); }
0xa0a36 => { let v = Some(com::OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 2614); }
0xa0809 => { let v = Some(egi::EnergyPricingPolicy::read(r)?); r.set(&mut e3, v.map(Box::new), 2057); }
0xa05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xa0658 => { let v = r.raw()?; r.set(&mut e5, 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_method: e1,
overall_period: e2,
energy_pricing_policy: e3,
rates_extension: e4,
unspecified_rates_extension: e5,
};
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("fac:applicableCurrency", v)?; }
if let Some(v) = &self.payment_method { v.write(w, "fac:paymentMethod", "", "")?; }
if let Some(v) = &self.overall_period { v.write(w, "fac:overallPeriod", "", "")?; }
if let Some(v) = &self.energy_pricing_policy { v.write(w, "fac:energyPricingPolicy", "", "")?; }
if let Some(v) = &self.rates_extension { w.extension("fac:_ratesExtension", v)?; }
if let Some(v) = &self.unspecified_rates_extension { w.extension("fac:_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; 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); } } },
1548 => if r.first(&mut seen[1])? { f1 = PaymentMethod::read_json(r)?.map(Box::new); },
1513 => if r.first(&mut seen[2])? { f2 = com::OverallPeriod::read_json(r)?.map(Box::new); },
676 => if r.first(&mut seen[3])? { f3 = egi::EnergyPricingPolicy::read_json(r)?.map(Box::new); },
804 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
828 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_currency: f0,
payment_method: f1,
overall_period: f2,
energy_pricing_policy: f3,
rates_extension: f4,
unspecified_rates_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(435)?;
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_method {
w.key(1548)?;
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.energy_pricing_policy {
w.key(676)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.rates_extension {
w.key(804)?;
w.extension(v)?;
}
if let Some(v) = &self.unspecified_rates_extension {
w.key(828)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `fac:UserQualification`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UserQualification {
/// XML element `fac:userGroup`.
pub user_group: Option<UserTypeEnum>,
/// XML element `fac:_userQualificationExtension`.
pub user_qualification_extension: Option<Box<Extension>>,
}
impl UserQualification {
const FIELDS: &'static [u32] = &[0xa0c7b, 0xa065c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xa0264);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xa0c7b => { let v = r.enumeration::<UserTypeEnum>()?; r.set(&mut e0, v, 3195); }
0xa065c => { 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("fac:userGroup", v.literal())?; }
None => return Err(w.missing("fac:userGroup")),
}
if let Some(v) = &self.user_qualification_extension { w.extension("fac:_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>()?; },
829 => 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(436)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.user_group {
Some(v) => {
w.key(2528)?;
w.enumeration(437, v.literal())?;
}
None => w.absent(2528, w.missing("userGroup"))?,
}
if let Some(v) = &self.user_qualification_extension {
w.key(829)?;
w.extension(v)?;
}
w.end_object()
}
}
/// Any concrete kind of XML type `fac:AssociatedFacility`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyAssociatedFacility {
/// XML type `fac:AssociatedFacility`.
AssociatedFacility(Box<AssociatedFacility>),
/// XML type `egi:AssociatedParking`.
AssociatedParking(Box<egi::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(0xa0039) => Self::AssociatedFacility(Box::new(AssociatedFacility::read(r)?)),
Some(0x8003a) => Self::AssociatedParking(Box::new(egi::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 `fac: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 `fac: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 `fac: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 `fac:_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=\"egi: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, 747 | 611) {
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 {
747 => if r.first(&mut seen)? { value = AssociatedFacility::read_json(r)?.map(|v| Self::AssociatedFacility(Box::new(v))); },
611 => if r.first(&mut seen)? { value = egi::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(747)? {
w.begin_object(359)?;
w.key(747)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::AssociatedParking(v) => {
if w.wrapper(611)? {
w.begin_object(359)?;
w.key(611)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:ContactInformation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyContactInformation {
/// XML type `fac:ContactInformation`.
ContactInformation(Box<ContactInformation>),
/// XML type `fac: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(0xa005e) => Self::ContactInformation(Box::new(ContactInformation::read(r)?)),
Some(0xa005f) => 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 `fac: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 `fac: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 `fac: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 `fac: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 `fac:_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=\"fac: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, 752 | 754) {
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 {
752 => if r.first(&mut seen)? { value = ContactInformation::read_json(r)?.map(|v| Self::ContactInformation(Box::new(v))); },
754 => 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(752)? {
w.begin_object(365)?;
w.key(752)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::ContactPerson(v) => {
if w.wrapper(754)? {
w.begin_object(365)?;
w.key(754)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:Credential`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyCredential {
/// XML type `fac:Credential`.
Credential(Box<Credential>),
/// XML type `fac: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(0xa0066) => Self::Credential(Box::new(Credential::read(r)?)),
Some(0xa0067) => 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 `fac: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 `fac: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 `fac:_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=\"fac: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, 756 | 757) {
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 {
756 => if r.first(&mut seen)? { value = Credential::read_json(r)?.map(|v| Self::Credential(Box::new(v))); },
757 => 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(756)? {
w.begin_object(369)?;
w.key(756)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::CredentialAssigned(v) => {
if w.wrapper(757)? {
w.begin_object(369)?;
w.key(757)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:OperatingHours`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum OperatingHours {
/// XML type `fac:OpenAllHours`.
OpenAllHours(Box<OpenAllHours>),
/// XML type `fac:OperatingHoursByReference`.
OperatingHoursByReference(Box<OperatingHoursByReference>),
/// XML type `fac:OperatingHoursSpecification`.
OperatingHoursSpecification(Box<OperatingHoursSpecification>),
/// XML type `fac:UndefinedOperatingHours`.
UndefinedOperatingHours(Box<UndefinedOperatingHours>),
/// XML type `fac: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(0xa0137) => Self::OpenAllHours(Box::new(OpenAllHours::read(r)?)),
Some(0xa014e) => Self::OperatingHoursByReference(Box::new(OperatingHoursByReference::read(r)?)),
Some(0xa0150) => Self::OperatingHoursSpecification(Box::new(OperatingHoursSpecification::read(r)?)),
Some(0xa025b) => Self::UndefinedOperatingHours(Box::new(UndefinedOperatingHours::read(r)?)),
Some(0xa025d) => Self::UnknownOperatingHours(Box::new(UnknownOperatingHours::read(r)?)),
_ => {
r.unknown_type("OperatingHours")?;
return Ok(None);
}
}))
}
/// XML element `fac: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 `fac:_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=\"fac:OpenAllHours\"", ""),
Self::OperatingHoursByReference(v) => v.write(w, tag, " xsi:type=\"fac:OperatingHoursByReference\"", ""),
Self::OperatingHoursSpecification(v) => v.write(w, tag, " xsi:type=\"fac:OperatingHoursSpecification\"", ""),
Self::UndefinedOperatingHours(v) => v.write(w, tag, " xsi:type=\"fac:UndefinedOperatingHours\"", ""),
Self::UnknownOperatingHours(v) => v.write(w, tag, " xsi:type=\"fac: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 {
772 => if r.first(&mut seen)? { value = OpenAllHours::read_json(r)?.map(|v| Self::OpenAllHours(Box::new(v))); },
774 => if r.first(&mut seen)? { value = OperatingHoursByReference::read_json(r)?.map(|v| Self::OperatingHoursByReference(Box::new(v))); },
779 => if r.first(&mut seen)? { value = OperatingHoursSpecification::read_json(r)?.map(|v| Self::OperatingHoursSpecification(Box::new(v))); },
817 => if r.first(&mut seen)? { value = UndefinedOperatingHours::read_json(r)?.map(|v| Self::UndefinedOperatingHours(Box::new(v))); },
821 => 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(772)? {
w.begin_object(387)?;
w.key(772)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OperatingHoursByReference(v) => {
if w.wrapper(774)? {
w.begin_object(387)?;
w.key(774)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OperatingHoursSpecification(v) => {
if w.wrapper(779)? {
w.begin_object(387)?;
w.key(779)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UndefinedOperatingHours(v) => {
if w.wrapper(817)? {
w.begin_object(387)?;
w.key(817)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnknownOperatingHours(v) => {
if w.wrapper(821)? {
w.begin_object(387)?;
w.key(821)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:Organisation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Organisation {
/// XML type `fac:OrganisationByReference`.
OrganisationByReference(Box<OrganisationByReference>),
/// XML type `fac:OrganisationSpecification`.
OrganisationSpecification(Box<OrganisationSpecification>),
/// XML type `fac:UndefinedOrganisation`.
UndefinedOrganisation(Box<UndefinedOrganisation>),
/// XML type `fac: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(0xa015c) => Self::OrganisationByReference(Box::new(OrganisationByReference::read(r)?)),
Some(0xa015e) => Self::OrganisationSpecification(Box::new(OrganisationSpecification::read(r)?)),
Some(0xa025c) => Self::UndefinedOrganisation(Box::new(UndefinedOrganisation::read(r)?)),
Some(0xa025e) => Self::UnknownOrganisation(Box::new(UnknownOrganisation::read(r)?)),
_ => {
r.unknown_type("Organisation")?;
return Ok(None);
}
}))
}
/// XML element `fac:generalTimeValidity`, which every kind has.
pub fn general_time_validity(&self) -> Option<&com::OverallPeriod> {
match self {
Self::OrganisationByReference(v) => v.general_time_validity.as_deref(),
Self::OrganisationSpecification(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 `fac:_organisationExtension`, which every kind has.
pub fn organisation_extension(&self) -> Option<&Extension> {
match self {
Self::OrganisationByReference(v) => v.organisation_extension.as_deref(),
Self::OrganisationSpecification(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::OrganisationByReference(v) => v.write(w, tag, " xsi:type=\"fac:OrganisationByReference\"", ""),
Self::OrganisationSpecification(v) => v.write(w, tag, " xsi:type=\"fac:OrganisationSpecification\"", ""),
Self::UndefinedOrganisation(v) => v.write(w, tag, " xsi:type=\"fac:UndefinedOrganisation\"", ""),
Self::UnknownOrganisation(v) => v.write(w, tag, " xsi:type=\"fac: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 {
782 => if r.first(&mut seen)? { value = OrganisationByReference::read_json(r)?.map(|v| Self::OrganisationByReference(Box::new(v))); },
787 => if r.first(&mut seen)? { value = OrganisationSpecification::read_json(r)?.map(|v| Self::OrganisationSpecification(Box::new(v))); },
819 => if r.first(&mut seen)? { value = UndefinedOrganisation::read_json(r)?.map(|v| Self::UndefinedOrganisation(Box::new(v))); },
823 => 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::OrganisationByReference(v) => {
if w.wrapper(782)? {
w.begin_object(393)?;
w.key(782)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OrganisationSpecification(v) => {
if w.wrapper(787)? {
w.begin_object(393)?;
w.key(787)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UndefinedOrganisation(v) => {
if w.wrapper(819)? {
w.begin_object(393)?;
w.key(819)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnknownOrganisation(v) => {
if w.wrapper(823)? {
w.begin_object(393)?;
w.key(823)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:RateLineCollection`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyRateLineCollection {
/// XML type `fac:RateLineCollection`.
RateLineCollection(Box<RateLineCollection>),
/// XML type `fac: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(0xa01ac) => Self::RateLineCollection(Box::new(RateLineCollection::read(r)?)),
Some(0xa01bf) => 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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac:_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=\"fac: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, 795 | 807) {
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 {
795 => if r.first(&mut seen)? { value = RateLineCollection::read_json(r)?.map(|v| Self::RateLineCollection(Box::new(v))); },
807 => 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(795)? {
w.begin_object(408)?;
w.key(795)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RelativeTimeRates(v) => {
if w.wrapper(807)? {
w.begin_object(408)?;
w.key(807)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:Rates`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Rates {
/// XML type `fac:FreeOfCharge`.
FreeOfCharge(Box<FreeOfCharge>),
/// XML type `fac:GeneralRateInformation`.
GeneralRateInformation(Box<GeneralRateInformation>),
/// XML type `fac:RateTable`.
RateTable(Box<RateTable>),
/// XML type `fac:RatesByReference`.
RatesByReference(Box<RatesByReference>),
/// XML type `fac:UnknownRates`.
UnknownRates(Box<UnknownRates>),
/// XML type `fac: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(0xa00ba) => Self::FreeOfCharge(Box::new(FreeOfCharge::read(r)?)),
Some(0xa00c7) => Self::GeneralRateInformation(Box::new(GeneralRateInformation::read(r)?)),
Some(0xa01b0) => Self::RateTable(Box::new(RateTable::read(r)?)),
Some(0xa01b3) => Self::RatesByReference(Box::new(RatesByReference::read(r)?)),
Some(0xa025f) => Self::UnknownRates(Box::new(UnknownRates::read(r)?)),
Some(0xa0260) => Self::UnspecifiedRates(Box::new(UnspecifiedRates::read(r)?)),
_ => {
r.unknown_type("Rates")?;
return Ok(None);
}
}))
}
/// XML element `fac: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::RateTable(v) => &v.applicable_currency,
Self::RatesByReference(v) => &v.applicable_currency,
Self::UnknownRates(v) => &v.applicable_currency,
Self::UnspecifiedRates(v) => &v.applicable_currency,
}
}
/// XML element `fac:paymentMethod`, which every kind has.
pub fn payment_method(&self) -> Option<&PaymentMethod> {
match self {
Self::FreeOfCharge(v) => v.payment_method.as_deref(),
Self::GeneralRateInformation(v) => v.payment_method.as_deref(),
Self::RateTable(v) => v.payment_method.as_deref(),
Self::RatesByReference(v) => v.payment_method.as_deref(),
Self::UnknownRates(v) => v.payment_method.as_deref(),
Self::UnspecifiedRates(v) => v.payment_method.as_deref(),
}
}
/// XML element `fac: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::RateTable(v) => v.overall_period.as_deref(),
Self::RatesByReference(v) => v.overall_period.as_deref(),
Self::UnknownRates(v) => v.overall_period.as_deref(),
Self::UnspecifiedRates(v) => v.overall_period.as_deref(),
}
}
/// XML element `fac:energyPricingPolicy`, which every kind has.
pub fn energy_pricing_policy(&self) -> Option<&egi::EnergyPricingPolicy> {
match self {
Self::FreeOfCharge(v) => v.energy_pricing_policy.as_deref(),
Self::GeneralRateInformation(v) => v.energy_pricing_policy.as_deref(),
Self::RateTable(v) => v.energy_pricing_policy.as_deref(),
Self::RatesByReference(v) => v.energy_pricing_policy.as_deref(),
Self::UnknownRates(v) => v.energy_pricing_policy.as_deref(),
Self::UnspecifiedRates(v) => v.energy_pricing_policy.as_deref(),
}
}
/// XML element `fac:_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::RateTable(v) => v.rates_extension.as_deref(),
Self::RatesByReference(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=\"fac:FreeOfCharge\"", ""),
Self::GeneralRateInformation(v) => v.write(w, tag, " xsi:type=\"fac:GeneralRateInformation\"", ""),
Self::RateTable(v) => v.write(w, tag, " xsi:type=\"fac:RateTable\"", ""),
Self::RatesByReference(v) => v.write(w, tag, " xsi:type=\"fac:RatesByReference\"", ""),
Self::UnknownRates(v) => v.write(w, tag, " xsi:type=\"fac:UnknownRates\"", ""),
Self::UnspecifiedRates(v) => v.write(w, tag, " xsi:type=\"fac: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 {
767 => if r.first(&mut seen)? { value = FreeOfCharge::read_json(r)?.map(|v| Self::FreeOfCharge(Box::new(v))); },
769 => if r.first(&mut seen)? { value = GeneralRateInformation::read_json(r)?.map(|v| Self::GeneralRateInformation(Box::new(v))); },
800 => if r.first(&mut seen)? { value = RateTable::read_json(r)?.map(|v| Self::RateTable(Box::new(v))); },
802 => if r.first(&mut seen)? { value = RatesByReference::read_json(r)?.map(|v| Self::RatesByReference(Box::new(v))); },
825 => if r.first(&mut seen)? { value = UnknownRates::read_json(r)?.map(|v| Self::UnknownRates(Box::new(v))); },
827 => 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(767)? {
w.begin_object(416)?;
w.key(767)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::GeneralRateInformation(v) => {
if w.wrapper(769)? {
w.begin_object(416)?;
w.key(769)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RateTable(v) => {
if w.wrapper(800)? {
w.begin_object(416)?;
w.key(800)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RatesByReference(v) => {
if w.wrapper(802)? {
w.begin_object(416)?;
w.key(802)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnknownRates(v) => {
if w.wrapper(825)? {
w.begin_object(416)?;
w.key(825)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::UnspecifiedRates(v) => {
if w.wrapper(827)? {
w.begin_object(416)?;
w.key(827)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `fac:SupplementalFacility`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum SupplementalFacility {
/// XML type `egi:ElectricChargingEquipment`.
ElectricChargingEquipment(Box<egi::ElectricChargingEquipment>),
/// XML type `fac:SupplementalEquipment`.
SupplementalEquipment(Box<SupplementalEquipment>),
/// XML type `fac: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(0x80093) => Self::ElectricChargingEquipment(Box::new(egi::ElectricChargingEquipment::read(r)?)),
Some(0xa020b) => Self::SupplementalEquipment(Box::new(SupplementalEquipment::read(r)?)),
Some(0xa020e) => 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 `fac: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 `fac: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 `fac:externalIdentifier`, which every kind has.
pub fn external_identifier(&self) -> Option<&str> {
match self {
Self::ElectricChargingEquipment(v) => v.external_identifier.as_deref(),
Self::SupplementalEquipment(v) => v.external_identifier.as_deref(),
Self::SupplementalServiceFacility(v) => v.external_identifier.as_deref(),
}
}
/// XML element `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac: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 `fac:_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 `fac: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 `fac: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 `fac: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 `fac: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 `fac:_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=\"egi:ElectricChargingEquipment\"", ""),
Self::SupplementalEquipment(v) => v.write(w, tag, " xsi:type=\"fac:SupplementalEquipment\"", ""),
Self::SupplementalServiceFacility(v) => v.write(w, tag, " xsi:type=\"fac: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 {
616 => if r.first(&mut seen)? { value = egi::ElectricChargingEquipment::read_json(r)?.map(|v| Self::ElectricChargingEquipment(Box::new(v))); },
810 => if r.first(&mut seen)? { value = SupplementalEquipment::read_json(r)?.map(|v| Self::SupplementalEquipment(Box::new(v))); },
814 => 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(616)? {
w.begin_object(425)?;
w.key(616)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SupplementalEquipment(v) => {
if w.wrapper(810)? {
w.begin_object(425)?;
w.key(810)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SupplementalServiceFacility(v) => {
if w.wrapper(814)? {
w.begin_object(425)?;
w.key(814)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}