use crate::traits::{SEList, SEResource, SESubscribableResource, Validate};
use sep2_common_derive::{SEList, SEResource, SESubscribableResource};
use super::{
links::{PriceResponseCfgListLink, RateComponentLink},
primitives::{Int32, String32, Uint32},
types::{DstRuleType, LocaleType, SubscribableType, TimeOffsetType, TimeType},
};
use yaserde::{YaDeserialize, YaSerialize};
#[derive(
Default,
PartialEq,
Eq,
Debug,
Clone,
YaSerialize,
YaDeserialize,
SESubscribableResource,
SEResource,
)]
#[yaserde(rename = "Configuration")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct Configuration {
#[yaserde(rename = "currentLocale")]
pub current_locale: LocaleType,
#[yaserde(rename = "PowerConfiguration")]
pub power_configuration: Option<PowerConfiguration>,
#[yaserde(rename = "PriceResponseCfgListLink")]
pub price_response_cfg_list_link: Option<PriceResponseCfgListLink>,
#[yaserde(rename = "TimeConfiguration")]
pub time_configuration: Option<TimeConfiguration>,
#[yaserde(rename = "userDeviceName")]
pub user_device_name: String32,
#[yaserde(attribute, rename = "pollRate")]
pub poll_rate: Option<Uint32>,
#[yaserde(attribute, rename = "subscribable")]
pub subscribable: Option<SubscribableType>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for Configuration {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize)]
#[yaserde(rename = "PowerConfiguration")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct PowerConfiguration {
#[yaserde(rename = "batteryInstallTime")]
pub battery_install_time: Option<TimeType>,
#[yaserde(rename = "lowChargeThreshold")]
pub low_charge_threshold: Option<Uint32>,
}
impl Validate for PowerConfiguration {}
#[derive(
Default, PartialEq, PartialOrd, Eq, Ord, Debug, Clone, YaSerialize, YaDeserialize, SEResource,
)]
#[yaserde(rename = "PriceResponseCfg")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct PriceResponseCfg {
#[yaserde(rename = "consumeThreshold")]
pub consume_threshold: Int32,
#[yaserde(rename = "maxReductionThreshold")]
pub max_reduction_threshold: Int32,
#[yaserde(rename = "RateComponentLink")]
pub rate_component_link: RateComponentLink,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for PriceResponseCfg {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "PriceResponseCfgList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct PriceResponseCfgList {
#[yaserde(rename = "PriceResponseCfg")]
pub price_response_cfg: Vec<PriceResponseCfg>,
#[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 PriceResponseCfgList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize)]
#[yaserde(rename = "TimeConfiguration")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct TimeConfiguration {
#[yaserde(rename = "dstEndRule")]
pub dst_end_rule: DstRuleType,
#[yaserde(rename = "dstOffset")]
pub dst_offset: TimeOffsetType,
#[yaserde(rename = "dstStartRule")]
pub dst_start_rule: DstRuleType,
#[yaserde(rename = "tzOffset")]
pub tz_offset: TimeOffsetType,
}
impl Validate for TimeConfiguration {}