use crate::traits::{
SEBillingMeterReadingBase, SEIdentifiedObject, SEList, SEMeterReadingBase, SEReadingBase,
SEReadingSetBase, SEResource, SESubscribableList, SESubscribableResource, Validate,
};
use sep2_common_derive::{
SEBillingMeterReadingBase, SEIdentifiedObject, SEList, SEMeterReadingBase, SEReadingBase,
SEReadingSetBase, SEResource, SESubscribableList, SESubscribableResource,
};
use super::{
links::{
ActiveBillingPeriodListLink, ActiveProjectionReadingListLink, ActiveTargetReadingListLink,
BillingPeriodListLink, BillingReadingListLink, BillingReadingSetListLink,
CustomerAgreementListLink, HistoricalReadingListLink, PrepaymentLink,
ProjectionReadingListLink, ReadingTypeLink, ServiceSupplierLink, TargetReadingListLink,
TariffProfileLink, UsagePointLink,
},
primitives::{Int32, Int48, String20, String32, String42, Uint16, Uint32},
types::{
ConsumptionBlockType, DateTimeInterval, MRIDType, PowerOfTenMultiplierType, QualityFlags,
SubscribableType, TOUType, TimeType, VersionType,
},
};
use yaserde::{YaDeserialize, YaSerialize};
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEResource)]
#[yaserde(rename = "BillingPeriod")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingPeriod {
#[yaserde(rename = "billLastPeriod")]
pub bill_last_period: Option<Int48>,
#[yaserde(rename = "billToDate")]
pub bill_to_date: Option<Int48>,
#[yaserde(rename = "interval")]
pub interval: DateTimeInterval,
#[yaserde(rename = "statusTimeStamp")]
pub status_time_stamp: Option<TimeType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for BillingPeriod {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for BillingPeriod {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.interval.start.cmp(&other.interval.start).reverse() {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.href.cmp(&other.href)
}
}
impl Validate for BillingPeriod {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SESubscribableList,
SEList,
SESubscribableResource,
SEResource,
)]
#[yaserde(rename = "BillingPeriodList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingPeriodList {
#[yaserde(rename = "BillingPeriod")]
pub billing_period: Vec<BillingPeriod>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "subscribable")]
pub subscribable: Option<SubscribableType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for BillingPeriodList {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SEMeterReadingBase,
SEIdentifiedObject,
SEResource,
SEBillingMeterReadingBase,
)]
#[yaserde(rename = "BillingMeterReadingBase")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingMeterReadingBase {
#[yaserde(rename = "BillingReadingSetListLink")]
pub billing_reading_set_list_link: Option<BillingReadingSetListLink>,
#[yaserde(rename = "ReadingTypeLink")]
pub reading_type_link: Option<ReadingTypeLink>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for BillingMeterReadingBase {}
#[derive(
Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEReadingBase, SEResource,
)]
#[yaserde(rename = "BillingReading")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingReading {
#[yaserde(rename = "Charge")]
pub charge: Vec<Charge>,
#[yaserde(rename = "consumptionBlock")]
pub consumption_block: Option<ConsumptionBlockType>,
#[yaserde(rename = "qualityFlags")]
pub quality_flags: Option<QualityFlags>,
#[yaserde(rename = "timePeriod")]
pub time_period: Option<DateTimeInterval>,
#[yaserde(rename = "touTier")]
pub tou_tier: Option<TOUType>,
#[yaserde(rename = "value")]
pub value: Option<Int48>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for BillingReading {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for BillingReading {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
if let Some((self_start, other_start)) =
self.time_period.as_ref().zip(other.time_period.as_ref())
{
match self_start.start.cmp(&other_start.start) {
std::cmp::Ordering::Equal => {}
ord => return ord,
}
}
match self.consumption_block.cmp(&other.consumption_block) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.tou_tier.cmp(&other.tou_tier)
}
}
impl Validate for BillingReading {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "BillingReadingList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingReadingList {
#[yaserde(rename = "BillingReading")]
pub billing_reading: Vec<BillingReading>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for BillingReadingList {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SEReadingSetBase,
SEIdentifiedObject,
SEResource,
)]
#[yaserde(rename = "BillingReadingSet")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingReadingSet {
#[yaserde(rename = "BillingReadingListLink")]
pub billing_reading_list_link: Option<BillingReadingListLink>,
#[yaserde(rename = "timePeriod")]
pub time_period: DateTimeInterval,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for BillingReadingSet {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for BillingReadingSet {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self
.time_period
.start
.cmp(&other.time_period.start)
.reverse()
{
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.mrid.cmp(&other.mrid).reverse()
}
}
impl Validate for BillingReadingSet {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SESubscribableList,
SEList,
SESubscribableResource,
SEResource,
)]
#[yaserde(rename = "BillingReadingSetList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct BillingReadingSetList {
#[yaserde(rename = "BillingReadingSet")]
pub billing_reading_set: Vec<BillingReadingSet>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "subscribable")]
pub subscribable: Option<SubscribableType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for BillingReadingSetList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize)]
#[yaserde(rename = "Charge")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct Charge {
#[yaserde(rename = "description")]
pub description: Option<String20>,
#[yaserde(rename = "kind")]
pub kind: Option<ChargeKind>,
#[yaserde(rename = "value")]
pub value: Int32,
}
impl Validate for Charge {}
#[derive(Default, PartialEq, Eq, Debug, Clone, Copy, YaSerialize, YaDeserialize)]
#[yaserde(rename = "ChargeKind")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
#[repr(u8)]
pub enum ChargeKind {
#[default]
ConsumptionCharge = 0,
Rebate = 1,
AuxiliaryCharge = 2,
DemandCharge = 3,
TaxCharge = 4,
}
impl Validate for ChargeKind {}
#[derive(
Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEIdentifiedObject, SEResource,
)]
#[yaserde(rename = "CustomerAccount")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct CustomerAccount {
#[yaserde(rename = "currency")]
pub currency: Uint16,
#[yaserde(rename = "customerAccount")]
pub customer_account: Option<String42>,
#[yaserde(rename = "CustomerAgreementListLink")]
pub customer_agreement_list_link: Option<CustomerAgreementListLink>,
#[yaserde(rename = "customerName")]
pub customer_name: Option<String42>,
#[yaserde(rename = "pricePowerOfTenMultiplier")]
pub price_power_of_ten_multiplier: PowerOfTenMultiplierType,
#[yaserde(rename = "ServiceSupplierLink")]
pub service_supplier_link: Option<ServiceSupplierLink>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for CustomerAccount {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for CustomerAccount {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.customer_name.cmp(&other.customer_name) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.mrid.cmp(&other.mrid).reverse()
}
}
impl Validate for CustomerAccount {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SESubscribableList,
SEList,
SESubscribableResource,
SEResource,
)]
#[yaserde(rename = "CustomerAccountList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct CustomerAccountList {
#[yaserde(rename = "CustomerAccount")]
pub customer_account: Vec<CustomerAccount>,
#[yaserde(attribute, rename = "pollRate")]
pub poll_rate: Option<Uint32>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "subscribable")]
pub subscribable: Option<SubscribableType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for CustomerAccountList {}
#[derive(
Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEIdentifiedObject, SEResource,
)]
#[yaserde(rename = "CustomerAgreement")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct CustomerAgreement {
#[yaserde(rename = "ActiveBillingPeriodListLink")]
pub active_billing_period_list_link: Option<ActiveBillingPeriodListLink>,
#[yaserde(rename = "ActiveProjectionReadingListLink")]
pub active_projection_reading_list_link: Option<ActiveProjectionReadingListLink>,
#[yaserde(rename = "ActiveTargetReadingListLink")]
pub active_target_reading_list_link: Option<ActiveTargetReadingListLink>,
#[yaserde(rename = "BillingPeriodListLink")]
pub billing_period_list_link: Option<BillingPeriodListLink>,
#[yaserde(rename = "HistoricalReadingListLink")]
pub historical_reading_list_link: Option<HistoricalReadingListLink>,
#[yaserde(rename = "PrepaymentLink")]
pub prepayment_link: Option<PrepaymentLink>,
#[yaserde(rename = "ProjectionReadingListLink")]
pub projection_reading_list_link: Option<ProjectionReadingListLink>,
#[yaserde(rename = "serviceAccount")]
pub service_account: Option<String42>,
#[yaserde(rename = "serviceLocation")]
pub service_location: Option<String42>,
#[yaserde(rename = "TargetReadingListLink")]
pub target_reading_list_link: Option<TargetReadingListLink>,
#[yaserde(rename = "TariffProfileLink")]
pub tariff_profile_link: Option<TariffProfileLink>,
#[yaserde(rename = "UsagePointLink")]
pub usage_point_link: Option<UsagePointLink>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for CustomerAgreement {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for CustomerAgreement {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.service_location.cmp(&other.service_location) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.mrid.cmp(&other.mrid).reverse()
}
}
impl Validate for CustomerAgreement {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SESubscribableList,
SEList,
SESubscribableResource,
SEResource,
)]
#[yaserde(rename = "CustomerAgreementList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct CustomerAgreementList {
#[yaserde(rename = "CustomerAgreement")]
pub customer_agreement: Vec<CustomerAgreement>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "subscribable")]
pub subscribable: Option<SubscribableType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for CustomerAgreementList {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SEBillingMeterReadingBase,
SEMeterReadingBase,
SEIdentifiedObject,
SEResource,
)]
#[yaserde(rename = "HistoricalReading")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct HistoricalReading {
#[yaserde(rename = "BillingReadingSetListLink")]
pub billing_reading_set_list_link: Option<BillingReadingSetListLink>,
#[yaserde(rename = "ReadingTypeLink")]
pub reading_type_link: Option<ReadingTypeLink>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for HistoricalReading {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for HistoricalReading {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.description.cmp(&other.description) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.mrid.cmp(&other.mrid).reverse()
}
}
impl Validate for HistoricalReading {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "HistoricalReadingList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct HistoricalReadingList {
#[yaserde(rename = "HistoricalReading")]
pub historical_reading: Vec<HistoricalReading>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for HistoricalReadingList {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SEBillingMeterReadingBase,
SEMeterReadingBase,
SEIdentifiedObject,
SEResource,
)]
#[yaserde(rename = "ProjectionReading")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct ProjectionReading {
#[yaserde(rename = "BillingReadingSetListLink")]
pub billing_reading_set_list_link: Option<BillingReadingSetListLink>,
#[yaserde(rename = "ReadingTypeLink")]
pub reading_type_link: Option<ReadingTypeLink>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for ProjectionReading {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for ProjectionReading {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.description.cmp(&other.description) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.mrid.cmp(&other.mrid).reverse()
}
}
impl Validate for ProjectionReading {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "ProjectionReadingList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct ProjectionReadingList {
#[yaserde(rename = "ProjectionReading")]
pub projection_reading: Vec<ProjectionReading>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for ProjectionReadingList {}
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SEBillingMeterReadingBase,
SEMeterReadingBase,
SEIdentifiedObject,
SEResource,
)]
#[yaserde(rename = "TargetReading")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct TargetReading {
#[yaserde(rename = "BillingReadingSetListLink")]
pub billing_reading_set_list_link: Option<BillingReadingSetListLink>,
#[yaserde(rename = "ReadingTypeLink")]
pub reading_type_link: Option<ReadingTypeLink>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for TargetReading {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for TargetReading {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.description.cmp(&other.description) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.mrid.cmp(&other.mrid).reverse()
}
}
impl Validate for TargetReading {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "TargetReadingList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct TargetReadingList {
#[yaserde(rename = "TargetReading")]
pub target_reading: Vec<TargetReading>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for TargetReadingList {}
#[derive(
Default,
PartialEq,
PartialOrd,
Eq,
Ord,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SEIdentifiedObject,
SEResource,
)]
#[yaserde(rename = "ServiceSupplier")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct ServiceSupplier {
#[yaserde(rename = "email")]
pub email: Option<String32>,
#[yaserde(rename = "phone")]
pub phone: Option<String20>,
#[yaserde(rename = "providerID")]
pub provider_id: Option<Uint32>,
#[yaserde(rename = "web")]
pub web: Option<String42>,
#[yaserde(rename = "mRID")]
pub mrid: MRIDType,
#[yaserde(rename = "description")]
pub description: Option<String32>,
#[yaserde(rename = "version")]
pub version: Option<VersionType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for ServiceSupplier {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "ServiceSupplierList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct ServiceSupplierList {
#[yaserde(rename = "ServiceSupplier")]
pub service_supplier: Vec<ServiceSupplier>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for ServiceSupplierList {}