#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
#![allow(
clippy::too_many_lines,
clippy::too_many_arguments,
clippy::wildcard_imports
)]
#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
use alloc::string::String;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use super::action::Action;
use super::enums::*;
use super::types::*;
use crate::message::{Confirmed, MessageKind, Origin, Request, Response, Sealed, Unconfirmed};
use crate::validate::{self, Validate, ValidationPath, Violations};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthorizeRequest {
#[serde(rename = "idTag")]
pub id_tag: String,
}
impl AuthorizeRequest {
#[must_use]
pub fn new(id_tag: impl Into<String>) -> Self {
Self {
id_tag: id_tag.into(),
}
}
}
impl Validate for AuthorizeRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTag");
validate::string(self.id_tag.as_str(), None, Some(20), path, out);
path.pop();
}
}
impl Sealed for AuthorizeRequest {}
impl Request for AuthorizeRequest {
type Action = Action;
const ACTION: Action = Action::Authorize;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = AuthorizeResponse;
}
impl Confirmed for AuthorizeRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthorizeResponse {
#[serde(rename = "idTagInfo")]
pub id_tag_info: IdTagInfo,
}
impl AuthorizeResponse {
#[must_use]
pub fn new(id_tag_info: IdTagInfo) -> Self {
Self { id_tag_info }
}
}
impl Validate for AuthorizeResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTagInfo");
Validate::validate_at(&self.id_tag_info, path, out);
path.pop();
}
}
impl Sealed for AuthorizeResponse {}
impl Response for AuthorizeResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BootNotificationRequest {
#[serde(rename = "chargePointVendor")]
pub charge_point_vendor: String,
#[serde(rename = "chargePointModel")]
pub charge_point_model: String,
#[serde(rename = "chargePointSerialNumber")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charge_point_serial_number: Option<String>,
#[serde(rename = "chargeBoxSerialNumber")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charge_box_serial_number: Option<String>,
#[serde(rename = "firmwareVersion")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub firmware_version: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub iccid: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub imsi: Option<String>,
#[serde(rename = "meterType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub meter_type: Option<String>,
#[serde(rename = "meterSerialNumber")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub meter_serial_number: Option<String>,
}
impl BootNotificationRequest {
#[must_use]
pub fn new(
charge_point_vendor: impl Into<String>,
charge_point_model: impl Into<String>,
) -> Self {
Self {
charge_point_vendor: charge_point_vendor.into(),
charge_point_model: charge_point_model.into(),
charge_point_serial_number: None,
charge_box_serial_number: None,
firmware_version: None,
iccid: None,
imsi: None,
meter_type: None,
meter_serial_number: None,
}
}
#[must_use]
pub fn with_charge_point_serial_number(mut self, value: impl Into<String>) -> Self {
self.charge_point_serial_number = Some(value.into());
self
}
#[must_use]
pub fn with_charge_box_serial_number(mut self, value: impl Into<String>) -> Self {
self.charge_box_serial_number = Some(value.into());
self
}
#[must_use]
pub fn with_firmware_version(mut self, value: impl Into<String>) -> Self {
self.firmware_version = Some(value.into());
self
}
#[must_use]
pub fn with_iccid(mut self, value: impl Into<String>) -> Self {
self.iccid = Some(value.into());
self
}
#[must_use]
pub fn with_imsi(mut self, value: impl Into<String>) -> Self {
self.imsi = Some(value.into());
self
}
#[must_use]
pub fn with_meter_type(mut self, value: impl Into<String>) -> Self {
self.meter_type = Some(value.into());
self
}
#[must_use]
pub fn with_meter_serial_number(mut self, value: impl Into<String>) -> Self {
self.meter_serial_number = Some(value.into());
self
}
}
impl Validate for BootNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargePointVendor");
validate::string(self.charge_point_vendor.as_str(), None, Some(20), path, out);
path.pop();
path.push_key("chargePointModel");
validate::string(self.charge_point_model.as_str(), None, Some(20), path, out);
path.pop();
path.push_key("chargePointSerialNumber");
if let Some(value) = &self.charge_point_serial_number {
validate::string(value.as_str(), None, Some(25), path, out);
}
path.pop();
path.push_key("chargeBoxSerialNumber");
if let Some(value) = &self.charge_box_serial_number {
validate::string(value.as_str(), None, Some(25), path, out);
}
path.pop();
path.push_key("firmwareVersion");
if let Some(value) = &self.firmware_version {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
path.push_key("iccid");
if let Some(value) = &self.iccid {
validate::string(value.as_str(), None, Some(20), path, out);
}
path.pop();
path.push_key("imsi");
if let Some(value) = &self.imsi {
validate::string(value.as_str(), None, Some(20), path, out);
}
path.pop();
path.push_key("meterType");
if let Some(value) = &self.meter_type {
validate::string(value.as_str(), None, Some(25), path, out);
}
path.pop();
path.push_key("meterSerialNumber");
if let Some(value) = &self.meter_serial_number {
validate::string(value.as_str(), None, Some(25), path, out);
}
path.pop();
}
}
impl Sealed for BootNotificationRequest {}
impl Request for BootNotificationRequest {
type Action = Action;
const ACTION: Action = Action::BootNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = BootNotificationResponse;
}
impl Confirmed for BootNotificationRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BootNotificationResponse {
pub status: RegistrationStatus,
#[serde(rename = "currentTime")]
pub current_time: crate::types::DateTime,
pub interval: i32,
}
impl BootNotificationResponse {
#[must_use]
pub fn new(
status: RegistrationStatus,
current_time: impl Into<crate::types::DateTime>,
interval: i32,
) -> Self {
Self {
status,
current_time: current_time.into(),
interval,
}
}
}
impl Validate for BootNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for BootNotificationResponse {}
impl Response for BootNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CancelReservationRequest {
#[serde(rename = "reservationId")]
pub reservation_id: i32,
}
impl CancelReservationRequest {
#[must_use]
pub fn new(reservation_id: i32) -> Self {
Self { reservation_id }
}
}
impl Validate for CancelReservationRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for CancelReservationRequest {}
impl Request for CancelReservationRequest {
type Action = Action;
const ACTION: Action = Action::CancelReservation;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = CancelReservationResponse;
}
impl Confirmed for CancelReservationRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CancelReservationResponse {
pub status: CancelReservationStatus,
}
impl CancelReservationResponse {
#[must_use]
pub fn new(status: CancelReservationStatus) -> Self {
Self { status }
}
}
impl Validate for CancelReservationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for CancelReservationResponse {}
impl Response for CancelReservationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CertificateSignedRequest {
#[serde(rename = "certificateChain")]
pub certificate_chain: String,
}
impl CertificateSignedRequest {
#[must_use]
pub fn new(certificate_chain: impl Into<String>) -> Self {
Self {
certificate_chain: certificate_chain.into(),
}
}
}
impl Validate for CertificateSignedRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateChain");
validate::string(
self.certificate_chain.as_str(),
None,
Some(10000),
path,
out,
);
path.pop();
}
}
impl Sealed for CertificateSignedRequest {}
impl Request for CertificateSignedRequest {
type Action = Action;
const ACTION: Action = Action::CertificateSigned;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = CertificateSignedResponse;
}
impl Confirmed for CertificateSignedRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CertificateSignedResponse {
pub status: CertificateSignedStatus,
}
impl CertificateSignedResponse {
#[must_use]
pub fn new(status: CertificateSignedStatus) -> Self {
Self { status }
}
}
impl Validate for CertificateSignedResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for CertificateSignedResponse {}
impl Response for CertificateSignedResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeAvailabilityRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
pub r#type: AvailabilityType,
}
impl ChangeAvailabilityRequest {
#[must_use]
pub fn new(connector_id: i32, r#type: AvailabilityType) -> Self {
Self {
connector_id,
r#type,
}
}
}
impl Validate for ChangeAvailabilityRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("type");
Validate::validate_at(&self.r#type, path, out);
path.pop();
}
}
impl Sealed for ChangeAvailabilityRequest {}
impl Request for ChangeAvailabilityRequest {
type Action = Action;
const ACTION: Action = Action::ChangeAvailability;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ChangeAvailabilityResponse;
}
impl Confirmed for ChangeAvailabilityRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeAvailabilityResponse {
pub status: AvailabilityStatus,
}
impl ChangeAvailabilityResponse {
#[must_use]
pub fn new(status: AvailabilityStatus) -> Self {
Self { status }
}
}
impl Validate for ChangeAvailabilityResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ChangeAvailabilityResponse {}
impl Response for ChangeAvailabilityResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeConfigurationRequest {
pub key: String,
pub value: String,
}
impl ChangeConfigurationRequest {
#[must_use]
pub fn new(key: impl Into<String>, value: impl Into<String>) -> Self {
Self {
key: key.into(),
value: value.into(),
}
}
}
impl Validate for ChangeConfigurationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("key");
validate::string(self.key.as_str(), None, Some(50), path, out);
path.pop();
path.push_key("value");
validate::string(self.value.as_str(), None, Some(500), path, out);
path.pop();
}
}
impl Sealed for ChangeConfigurationRequest {}
impl Request for ChangeConfigurationRequest {
type Action = Action;
const ACTION: Action = Action::ChangeConfiguration;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ChangeConfigurationResponse;
}
impl Confirmed for ChangeConfigurationRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeConfigurationResponse {
pub status: ConfigurationStatus,
}
impl ChangeConfigurationResponse {
#[must_use]
pub fn new(status: ConfigurationStatus) -> Self {
Self { status }
}
}
impl Validate for ChangeConfigurationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ChangeConfigurationResponse {}
impl Response for ChangeConfigurationResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearCacheRequest {}
impl ClearCacheRequest {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for ClearCacheRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for ClearCacheRequest {}
impl Request for ClearCacheRequest {
type Action = Action;
const ACTION: Action = Action::ClearCache;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearCacheResponse;
}
impl Confirmed for ClearCacheRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearCacheResponse {
pub status: ClearCacheStatus,
}
impl ClearCacheResponse {
#[must_use]
pub fn new(status: ClearCacheStatus) -> Self {
Self { status }
}
}
impl Validate for ClearCacheResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ClearCacheResponse {}
impl Response for ClearCacheResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearChargingProfileRequest {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<i32>,
#[serde(rename = "connectorId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub connector_id: Option<i32>,
#[serde(rename = "chargingProfilePurpose")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_profile_purpose: Option<ChargingProfilePurpose>,
#[serde(rename = "stackLevel")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub stack_level: Option<i32>,
}
impl ClearChargingProfileRequest {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn with_id(mut self, value: i32) -> Self {
self.id = Some(value);
self
}
#[must_use]
pub fn with_connector_id(mut self, value: i32) -> Self {
self.connector_id = Some(value);
self
}
#[must_use]
pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
self.charging_profile_purpose = Some(value);
self
}
#[must_use]
pub fn with_stack_level(mut self, value: i32) -> Self {
self.stack_level = Some(value);
self
}
}
impl Validate for ClearChargingProfileRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingProfilePurpose");
if let Some(value) = &self.charging_profile_purpose {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearChargingProfileRequest {}
impl Request for ClearChargingProfileRequest {
type Action = Action;
const ACTION: Action = Action::ClearChargingProfile;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearChargingProfileResponse;
}
impl Confirmed for ClearChargingProfileRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearChargingProfileResponse {
pub status: ClearChargingProfileStatus,
}
impl ClearChargingProfileResponse {
#[must_use]
pub fn new(status: ClearChargingProfileStatus) -> Self {
Self { status }
}
}
impl Validate for ClearChargingProfileResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ClearChargingProfileResponse {}
impl Response for ClearChargingProfileResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DataTransferRequest {
#[serde(rename = "vendorId")]
pub vendor_id: String,
#[serde(rename = "messageId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
}
impl DataTransferRequest {
#[must_use]
pub fn new(vendor_id: impl Into<String>) -> Self {
Self {
vendor_id: vendor_id.into(),
message_id: None,
data: None,
}
}
#[must_use]
pub fn with_message_id(mut self, value: impl Into<String>) -> Self {
self.message_id = Some(value.into());
self
}
#[must_use]
pub fn with_data(mut self, value: impl Into<String>) -> Self {
self.data = Some(value.into());
self
}
}
impl Validate for DataTransferRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("vendorId");
validate::string(self.vendor_id.as_str(), None, Some(255), path, out);
path.pop();
path.push_key("messageId");
if let Some(value) = &self.message_id {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
}
}
impl Sealed for DataTransferRequest {}
impl Request for DataTransferRequest {
type Action = Action;
const ACTION: Action = Action::DataTransfer;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Both;
type Response = DataTransferResponse;
}
impl Confirmed for DataTransferRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DataTransferResponse {
pub status: DataTransferStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
}
impl DataTransferResponse {
#[must_use]
pub fn new(status: DataTransferStatus) -> Self {
Self { status, data: None }
}
#[must_use]
pub fn with_data(mut self, value: impl Into<String>) -> Self {
self.data = Some(value.into());
self
}
}
impl Validate for DataTransferResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for DataTransferResponse {}
impl Response for DataTransferResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeleteCertificateRequest {
#[serde(rename = "certificateHashData")]
pub certificate_hash_data: CertificateHashData,
}
impl DeleteCertificateRequest {
#[must_use]
pub fn new(certificate_hash_data: CertificateHashData) -> Self {
Self {
certificate_hash_data,
}
}
}
impl Validate for DeleteCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateHashData");
Validate::validate_at(&self.certificate_hash_data, path, out);
path.pop();
}
}
impl Sealed for DeleteCertificateRequest {}
impl Request for DeleteCertificateRequest {
type Action = Action;
const ACTION: Action = Action::DeleteCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = DeleteCertificateResponse;
}
impl Confirmed for DeleteCertificateRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeleteCertificateResponse {
pub status: DeleteCertificateStatus,
}
impl DeleteCertificateResponse {
#[must_use]
pub fn new(status: DeleteCertificateStatus) -> Self {
Self { status }
}
}
impl Validate for DeleteCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for DeleteCertificateResponse {}
impl Response for DeleteCertificateResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DiagnosticsStatusNotificationRequest {
pub status: DiagnosticsStatus,
}
impl DiagnosticsStatusNotificationRequest {
#[must_use]
pub fn new(status: DiagnosticsStatus) -> Self {
Self { status }
}
}
impl Validate for DiagnosticsStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for DiagnosticsStatusNotificationRequest {}
impl Request for DiagnosticsStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::DiagnosticsStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = DiagnosticsStatusNotificationResponse;
}
impl Confirmed for DiagnosticsStatusNotificationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct DiagnosticsStatusNotificationResponse {}
impl DiagnosticsStatusNotificationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for DiagnosticsStatusNotificationResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for DiagnosticsStatusNotificationResponse {}
impl Response for DiagnosticsStatusNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ExtendedTriggerMessageRequest {
#[serde(rename = "requestedMessage")]
pub requested_message: ExtendedMessageTrigger,
#[serde(rename = "connectorId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub connector_id: Option<i32>,
}
impl ExtendedTriggerMessageRequest {
#[must_use]
pub fn new(requested_message: ExtendedMessageTrigger) -> Self {
Self {
requested_message,
connector_id: None,
}
}
#[must_use]
pub fn with_connector_id(mut self, value: i32) -> Self {
self.connector_id = Some(value);
self
}
}
impl Validate for ExtendedTriggerMessageRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("requestedMessage");
Validate::validate_at(&self.requested_message, path, out);
path.pop();
}
}
impl Sealed for ExtendedTriggerMessageRequest {}
impl Request for ExtendedTriggerMessageRequest {
type Action = Action;
const ACTION: Action = Action::ExtendedTriggerMessage;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ExtendedTriggerMessageResponse;
}
impl Confirmed for ExtendedTriggerMessageRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ExtendedTriggerMessageResponse {
pub status: TriggerMessageStatus,
}
impl ExtendedTriggerMessageResponse {
#[must_use]
pub fn new(status: TriggerMessageStatus) -> Self {
Self { status }
}
}
impl Validate for ExtendedTriggerMessageResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ExtendedTriggerMessageResponse {}
impl Response for ExtendedTriggerMessageResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct FirmwareStatusNotificationRequest {
pub status: FirmwareStatus,
}
impl FirmwareStatusNotificationRequest {
#[must_use]
pub fn new(status: FirmwareStatus) -> Self {
Self { status }
}
}
impl Validate for FirmwareStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for FirmwareStatusNotificationRequest {}
impl Request for FirmwareStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::FirmwareStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = FirmwareStatusNotificationResponse;
}
impl Confirmed for FirmwareStatusNotificationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct FirmwareStatusNotificationResponse {}
impl FirmwareStatusNotificationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for FirmwareStatusNotificationResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for FirmwareStatusNotificationResponse {}
impl Response for FirmwareStatusNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCompositeScheduleRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
pub duration: i32,
#[serde(rename = "chargingRateUnit")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_rate_unit: Option<ChargingRateUnit>,
}
impl GetCompositeScheduleRequest {
#[must_use]
pub fn new(connector_id: i32, duration: i32) -> Self {
Self {
connector_id,
duration,
charging_rate_unit: None,
}
}
#[must_use]
pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
self.charging_rate_unit = Some(value);
self
}
}
impl Validate for GetCompositeScheduleRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingRateUnit");
if let Some(value) = &self.charging_rate_unit {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCompositeScheduleRequest {}
impl Request for GetCompositeScheduleRequest {
type Action = Action;
const ACTION: Action = Action::GetCompositeSchedule;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetCompositeScheduleResponse;
}
impl Confirmed for GetCompositeScheduleRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCompositeScheduleResponse {
pub status: GetCompositeScheduleStatus,
#[serde(rename = "connectorId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub connector_id: Option<i32>,
#[serde(rename = "scheduleStart")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub schedule_start: Option<crate::types::DateTime>,
#[serde(rename = "chargingSchedule")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_schedule: Option<ChargingSchedule>,
}
impl GetCompositeScheduleResponse {
#[must_use]
pub fn new(status: GetCompositeScheduleStatus) -> Self {
Self {
status,
connector_id: None,
schedule_start: None,
charging_schedule: None,
}
}
#[must_use]
pub fn with_connector_id(mut self, value: i32) -> Self {
self.connector_id = Some(value);
self
}
#[must_use]
pub fn with_schedule_start(mut self, value: impl Into<crate::types::DateTime>) -> Self {
self.schedule_start = Some(value.into());
self
}
#[must_use]
pub fn with_charging_schedule(mut self, value: ChargingSchedule) -> Self {
self.charging_schedule = Some(value);
self
}
}
impl Validate for GetCompositeScheduleResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("chargingSchedule");
if let Some(value) = &self.charging_schedule {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCompositeScheduleResponse {}
impl Response for GetCompositeScheduleResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetConfigurationRequest {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub key: Option<Vec<String>>,
}
impl GetConfigurationRequest {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn with_key(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.key = Some(value.into_iter().map(Into::into).collect());
self
}
}
impl Validate for GetConfigurationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("key");
if let Some(value) = &self.key {
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(50), path, out);
path.pop();
}
}
path.pop();
}
}
impl Sealed for GetConfigurationRequest {}
impl Request for GetConfigurationRequest {
type Action = Action;
const ACTION: Action = Action::GetConfiguration;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetConfigurationResponse;
}
impl Confirmed for GetConfigurationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetConfigurationResponse {
#[serde(rename = "configurationKey")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub configuration_key: Option<Vec<KeyValue>>,
#[serde(rename = "unknownKey")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unknown_key: Option<Vec<String>>,
}
impl GetConfigurationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn with_configuration_key(mut self, value: Vec<KeyValue>) -> Self {
self.configuration_key = Some(value);
self
}
#[must_use]
pub fn with_unknown_key(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.unknown_key = Some(value.into_iter().map(Into::into).collect());
self
}
}
impl Validate for GetConfigurationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("configurationKey");
if let Some(value) = &self.configuration_key {
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("unknownKey");
if let Some(value) = &self.unknown_key {
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(50), path, out);
path.pop();
}
}
path.pop();
}
}
impl Sealed for GetConfigurationResponse {}
impl Response for GetConfigurationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetDiagnosticsRequest {
pub location: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub retries: Option<i32>,
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub retry_interval: Option<i32>,
#[serde(rename = "startTime")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub start_time: Option<crate::types::DateTime>,
#[serde(rename = "stopTime")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub stop_time: Option<crate::types::DateTime>,
}
impl GetDiagnosticsRequest {
#[must_use]
pub fn new(location: impl Into<String>) -> Self {
Self {
location: location.into(),
retries: None,
retry_interval: None,
start_time: None,
stop_time: None,
}
}
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
#[must_use]
pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
self.start_time = Some(value.into());
self
}
#[must_use]
pub fn with_stop_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
self.stop_time = Some(value.into());
self
}
}
impl Validate for GetDiagnosticsRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for GetDiagnosticsRequest {}
impl Request for GetDiagnosticsRequest {
type Action = Action;
const ACTION: Action = Action::GetDiagnostics;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetDiagnosticsResponse;
}
impl Confirmed for GetDiagnosticsRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDiagnosticsResponse {
#[serde(rename = "fileName")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
}
impl GetDiagnosticsResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn with_file_name(mut self, value: impl Into<String>) -> Self {
self.file_name = Some(value.into());
self
}
}
impl Validate for GetDiagnosticsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("fileName");
if let Some(value) = &self.file_name {
validate::string(value.as_str(), None, Some(255), path, out);
}
path.pop();
}
}
impl Sealed for GetDiagnosticsResponse {}
impl Response for GetDiagnosticsResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetInstalledCertificateIdsRequest {
#[serde(rename = "certificateType")]
pub certificate_type: CertificateUse,
}
impl GetInstalledCertificateIdsRequest {
#[must_use]
pub fn new(certificate_type: CertificateUse) -> Self {
Self { certificate_type }
}
}
impl Validate for GetInstalledCertificateIdsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateType");
Validate::validate_at(&self.certificate_type, path, out);
path.pop();
}
}
impl Sealed for GetInstalledCertificateIdsRequest {}
impl Request for GetInstalledCertificateIdsRequest {
type Action = Action;
const ACTION: Action = Action::GetInstalledCertificateIds;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetInstalledCertificateIdsResponse;
}
impl Confirmed for GetInstalledCertificateIdsRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetInstalledCertificateIdsResponse {
pub status: GetInstalledCertificateStatus,
#[serde(rename = "certificateHashData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_hash_data: Option<Vec<CertificateHashData>>,
}
impl GetInstalledCertificateIdsResponse {
#[must_use]
pub fn new(status: GetInstalledCertificateStatus) -> Self {
Self {
status,
certificate_hash_data: None,
}
}
#[must_use]
pub fn with_certificate_hash_data(mut self, value: Vec<CertificateHashData>) -> Self {
self.certificate_hash_data = Some(value);
self
}
}
impl Validate for GetInstalledCertificateIdsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("certificateHashData");
if let Some(value) = &self.certificate_hash_data {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
}
}
impl Sealed for GetInstalledCertificateIdsResponse {}
impl Response for GetInstalledCertificateIdsResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetLocalListVersionRequest {}
impl GetLocalListVersionRequest {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for GetLocalListVersionRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for GetLocalListVersionRequest {}
impl Request for GetLocalListVersionRequest {
type Action = Action;
const ACTION: Action = Action::GetLocalListVersion;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetLocalListVersionResponse;
}
impl Confirmed for GetLocalListVersionRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetLocalListVersionResponse {
#[serde(rename = "listVersion")]
pub list_version: i32,
}
impl GetLocalListVersionResponse {
#[must_use]
pub fn new(list_version: i32) -> Self {
Self { list_version }
}
}
impl Validate for GetLocalListVersionResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for GetLocalListVersionResponse {}
impl Response for GetLocalListVersionResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetLogRequest {
pub log: LogParameters,
#[serde(rename = "logType")]
pub log_type: LogType,
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retries: Option<i32>,
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retry_interval: Option<i32>,
}
impl GetLogRequest {
#[must_use]
pub fn new(log: LogParameters, log_type: LogType, request_id: i32) -> Self {
Self {
log,
log_type,
request_id,
retries: None,
retry_interval: None,
}
}
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
}
impl Validate for GetLogRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("log");
Validate::validate_at(&self.log, path, out);
path.pop();
path.push_key("logType");
Validate::validate_at(&self.log_type, path, out);
path.pop();
}
}
impl Sealed for GetLogRequest {}
impl Request for GetLogRequest {
type Action = Action;
const ACTION: Action = Action::GetLog;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetLogResponse;
}
impl Confirmed for GetLogRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetLogResponse {
pub status: LogStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub filename: Option<String>,
}
impl GetLogResponse {
#[must_use]
pub fn new(status: LogStatus) -> Self {
Self {
status,
filename: None,
}
}
#[must_use]
pub fn with_filename(mut self, value: impl Into<String>) -> Self {
self.filename = Some(value.into());
self
}
}
impl Validate for GetLogResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("filename");
if let Some(value) = &self.filename {
validate::string(value.as_str(), None, Some(255), path, out);
}
path.pop();
}
}
impl Sealed for GetLogResponse {}
impl Response for GetLogResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct HeartbeatRequest {}
impl HeartbeatRequest {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for HeartbeatRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for HeartbeatRequest {}
impl Request for HeartbeatRequest {
type Action = Action;
const ACTION: Action = Action::Heartbeat;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = HeartbeatResponse;
}
impl Confirmed for HeartbeatRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct HeartbeatResponse {
#[serde(rename = "currentTime")]
pub current_time: crate::types::DateTime,
}
impl HeartbeatResponse {
#[must_use]
pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
Self {
current_time: current_time.into(),
}
}
}
impl Validate for HeartbeatResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for HeartbeatResponse {}
impl Response for HeartbeatResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstallCertificateRequest {
#[serde(rename = "certificateType")]
pub certificate_type: CertificateUse,
pub certificate: String,
}
impl InstallCertificateRequest {
#[must_use]
pub fn new(certificate_type: CertificateUse, certificate: impl Into<String>) -> Self {
Self {
certificate_type,
certificate: certificate.into(),
}
}
}
impl Validate for InstallCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateType");
Validate::validate_at(&self.certificate_type, path, out);
path.pop();
path.push_key("certificate");
validate::string(self.certificate.as_str(), None, Some(5500), path, out);
path.pop();
}
}
impl Sealed for InstallCertificateRequest {}
impl Request for InstallCertificateRequest {
type Action = Action;
const ACTION: Action = Action::InstallCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = InstallCertificateResponse;
}
impl Confirmed for InstallCertificateRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstallCertificateResponse {
pub status: InstallCertificateStatus,
}
impl InstallCertificateResponse {
#[must_use]
pub fn new(status: InstallCertificateStatus) -> Self {
Self { status }
}
}
impl Validate for InstallCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for InstallCertificateResponse {}
impl Response for InstallCertificateResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogStatusNotificationRequest {
pub status: UploadLogStatus,
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
}
impl LogStatusNotificationRequest {
#[must_use]
pub fn new(status: UploadLogStatus) -> Self {
Self {
status,
request_id: None,
}
}
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
}
impl Validate for LogStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for LogStatusNotificationRequest {}
impl Request for LogStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::LogStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = LogStatusNotificationResponse;
}
impl Confirmed for LogStatusNotificationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct LogStatusNotificationResponse {}
impl LogStatusNotificationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for LogStatusNotificationResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for LogStatusNotificationResponse {}
impl Response for LogStatusNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MeterValuesRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
#[serde(rename = "meterValue")]
pub meter_value: Vec<MeterValue>,
#[serde(rename = "transactionId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transaction_id: Option<i32>,
}
impl MeterValuesRequest {
#[must_use]
pub fn new(connector_id: i32, meter_value: Vec<MeterValue>) -> Self {
Self {
connector_id,
meter_value,
transaction_id: None,
}
}
#[must_use]
pub fn with_transaction_id(mut self, value: i32) -> Self {
self.transaction_id = Some(value);
self
}
}
impl Validate for MeterValuesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("meterValue");
validate::list_len(self.meter_value.len(), Some(1), None, path, out);
for (index, item) in self.meter_value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
}
}
impl Sealed for MeterValuesRequest {}
impl Request for MeterValuesRequest {
type Action = Action;
const ACTION: Action = Action::MeterValues;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = MeterValuesResponse;
}
impl Confirmed for MeterValuesRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct MeterValuesResponse {}
impl MeterValuesResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for MeterValuesResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for MeterValuesResponse {}
impl Response for MeterValuesResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RemoteStartTransactionRequest {
#[serde(rename = "idTag")]
pub id_tag: String,
#[serde(rename = "connectorId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub connector_id: Option<i32>,
#[serde(rename = "chargingProfile")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_profile: Option<ChargingProfile>,
}
impl RemoteStartTransactionRequest {
#[must_use]
pub fn new(id_tag: impl Into<String>) -> Self {
Self {
id_tag: id_tag.into(),
connector_id: None,
charging_profile: None,
}
}
#[must_use]
pub fn with_connector_id(mut self, value: i32) -> Self {
self.connector_id = Some(value);
self
}
#[must_use]
pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
self.charging_profile = Some(value);
self
}
}
impl Validate for RemoteStartTransactionRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTag");
validate::string(self.id_tag.as_str(), None, Some(20), path, out);
path.pop();
path.push_key("chargingProfile");
if let Some(value) = &self.charging_profile {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RemoteStartTransactionRequest {}
impl Request for RemoteStartTransactionRequest {
type Action = Action;
const ACTION: Action = Action::RemoteStartTransaction;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = RemoteStartTransactionResponse;
}
impl Confirmed for RemoteStartTransactionRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RemoteStartTransactionResponse {
pub status: RemoteStartStopStatus,
}
impl RemoteStartTransactionResponse {
#[must_use]
pub fn new(status: RemoteStartStopStatus) -> Self {
Self { status }
}
}
impl Validate for RemoteStartTransactionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for RemoteStartTransactionResponse {}
impl Response for RemoteStartTransactionResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RemoteStopTransactionRequest {
#[serde(rename = "transactionId")]
pub transaction_id: i32,
}
impl RemoteStopTransactionRequest {
#[must_use]
pub fn new(transaction_id: i32) -> Self {
Self { transaction_id }
}
}
impl Validate for RemoteStopTransactionRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for RemoteStopTransactionRequest {}
impl Request for RemoteStopTransactionRequest {
type Action = Action;
const ACTION: Action = Action::RemoteStopTransaction;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = RemoteStopTransactionResponse;
}
impl Confirmed for RemoteStopTransactionRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RemoteStopTransactionResponse {
pub status: RemoteStartStopStatus,
}
impl RemoteStopTransactionResponse {
#[must_use]
pub fn new(status: RemoteStartStopStatus) -> Self {
Self { status }
}
}
impl Validate for RemoteStopTransactionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for RemoteStopTransactionResponse {}
impl Response for RemoteStopTransactionResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReserveNowRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
#[serde(rename = "expiryDate")]
pub expiry_date: crate::types::DateTime,
#[serde(rename = "idTag")]
pub id_tag: String,
#[serde(rename = "reservationId")]
pub reservation_id: i32,
#[serde(rename = "parentIdTag")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parent_id_tag: Option<String>,
}
impl ReserveNowRequest {
#[must_use]
pub fn new(
connector_id: i32,
expiry_date: impl Into<crate::types::DateTime>,
id_tag: impl Into<String>,
reservation_id: i32,
) -> Self {
Self {
connector_id,
expiry_date: expiry_date.into(),
id_tag: id_tag.into(),
reservation_id,
parent_id_tag: None,
}
}
#[must_use]
pub fn with_parent_id_tag(mut self, value: impl Into<String>) -> Self {
self.parent_id_tag = Some(value.into());
self
}
}
impl Validate for ReserveNowRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTag");
validate::string(self.id_tag.as_str(), None, Some(20), path, out);
path.pop();
path.push_key("parentIdTag");
if let Some(value) = &self.parent_id_tag {
validate::string(value.as_str(), None, Some(20), path, out);
}
path.pop();
}
}
impl Sealed for ReserveNowRequest {}
impl Request for ReserveNowRequest {
type Action = Action;
const ACTION: Action = Action::ReserveNow;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ReserveNowResponse;
}
impl Confirmed for ReserveNowRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReserveNowResponse {
pub status: ReservationStatus,
}
impl ReserveNowResponse {
#[must_use]
pub fn new(status: ReservationStatus) -> Self {
Self { status }
}
}
impl Validate for ReserveNowResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ReserveNowResponse {}
impl Response for ReserveNowResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResetRequest {
pub r#type: ResetType,
}
impl ResetRequest {
#[must_use]
pub fn new(r#type: ResetType) -> Self {
Self { r#type }
}
}
impl Validate for ResetRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("type");
Validate::validate_at(&self.r#type, path, out);
path.pop();
}
}
impl Sealed for ResetRequest {}
impl Request for ResetRequest {
type Action = Action;
const ACTION: Action = Action::Reset;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ResetResponse;
}
impl Confirmed for ResetRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResetResponse {
pub status: ResetStatus,
}
impl ResetResponse {
#[must_use]
pub fn new(status: ResetStatus) -> Self {
Self { status }
}
}
impl Validate for ResetResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for ResetResponse {}
impl Response for ResetResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SecurityEventNotificationRequest {
pub r#type: String,
pub timestamp: crate::types::DateTime,
#[serde(rename = "techInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tech_info: Option<String>,
}
impl SecurityEventNotificationRequest {
#[must_use]
pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
Self {
r#type: r#type.into(),
timestamp: timestamp.into(),
tech_info: None,
}
}
#[must_use]
pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
self.tech_info = Some(value.into());
self
}
}
impl Validate for SecurityEventNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("type");
validate::string(self.r#type.as_str(), None, Some(50), path, out);
path.pop();
path.push_key("techInfo");
if let Some(value) = &self.tech_info {
validate::string(value.as_str(), None, Some(255), path, out);
}
path.pop();
}
}
impl Sealed for SecurityEventNotificationRequest {}
impl Request for SecurityEventNotificationRequest {
type Action = Action;
const ACTION: Action = Action::SecurityEventNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = SecurityEventNotificationResponse;
}
impl Confirmed for SecurityEventNotificationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct SecurityEventNotificationResponse {}
impl SecurityEventNotificationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for SecurityEventNotificationResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for SecurityEventNotificationResponse {}
impl Response for SecurityEventNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendLocalListRequest {
#[serde(rename = "listVersion")]
pub list_version: i32,
#[serde(rename = "updateType")]
pub update_type: UpdateType,
#[serde(rename = "localAuthorizationList")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub local_authorization_list: Option<Vec<AuthorizationData>>,
}
impl SendLocalListRequest {
#[must_use]
pub fn new(list_version: i32, update_type: UpdateType) -> Self {
Self {
list_version,
update_type,
local_authorization_list: None,
}
}
#[must_use]
pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
self.local_authorization_list = Some(value);
self
}
}
impl Validate for SendLocalListRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("updateType");
Validate::validate_at(&self.update_type, path, out);
path.pop();
path.push_key("localAuthorizationList");
if let Some(value) = &self.local_authorization_list {
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
}
}
impl Sealed for SendLocalListRequest {}
impl Request for SendLocalListRequest {
type Action = Action;
const ACTION: Action = Action::SendLocalList;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SendLocalListResponse;
}
impl Confirmed for SendLocalListRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendLocalListResponse {
pub status: UpdateStatus,
}
impl SendLocalListResponse {
#[must_use]
pub fn new(status: UpdateStatus) -> Self {
Self { status }
}
}
impl Validate for SendLocalListResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for SendLocalListResponse {}
impl Response for SendLocalListResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetChargingProfileRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
#[serde(rename = "csChargingProfiles")]
pub cs_charging_profiles: ChargingProfile,
}
impl SetChargingProfileRequest {
#[must_use]
pub fn new(connector_id: i32, cs_charging_profiles: ChargingProfile) -> Self {
Self {
connector_id,
cs_charging_profiles,
}
}
}
impl Validate for SetChargingProfileRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("csChargingProfiles");
Validate::validate_at(&self.cs_charging_profiles, path, out);
path.pop();
}
}
impl Sealed for SetChargingProfileRequest {}
impl Request for SetChargingProfileRequest {
type Action = Action;
const ACTION: Action = Action::SetChargingProfile;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetChargingProfileResponse;
}
impl Confirmed for SetChargingProfileRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetChargingProfileResponse {
pub status: ChargingProfileStatus,
}
impl SetChargingProfileResponse {
#[must_use]
pub fn new(status: ChargingProfileStatus) -> Self {
Self { status }
}
}
impl Validate for SetChargingProfileResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for SetChargingProfileResponse {}
impl Response for SetChargingProfileResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignCertificateRequest {
pub csr: String,
}
impl SignCertificateRequest {
#[must_use]
pub fn new(csr: impl Into<String>) -> Self {
Self { csr: csr.into() }
}
}
impl Validate for SignCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("csr");
validate::string(self.csr.as_str(), None, Some(5500), path, out);
path.pop();
}
}
impl Sealed for SignCertificateRequest {}
impl Request for SignCertificateRequest {
type Action = Action;
const ACTION: Action = Action::SignCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = SignCertificateResponse;
}
impl Confirmed for SignCertificateRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignCertificateResponse {
pub status: GenericStatus,
}
impl SignCertificateResponse {
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self { status }
}
}
impl Validate for SignCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for SignCertificateResponse {}
impl Response for SignCertificateResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignedFirmwareStatusNotificationRequest {
pub status: SignedFirmwareStatus,
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
}
impl SignedFirmwareStatusNotificationRequest {
#[must_use]
pub fn new(status: SignedFirmwareStatus) -> Self {
Self {
status,
request_id: None,
}
}
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
}
impl Validate for SignedFirmwareStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for SignedFirmwareStatusNotificationRequest {}
impl Request for SignedFirmwareStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::SignedFirmwareStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = SignedFirmwareStatusNotificationResponse;
}
impl Confirmed for SignedFirmwareStatusNotificationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct SignedFirmwareStatusNotificationResponse {}
impl SignedFirmwareStatusNotificationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for SignedFirmwareStatusNotificationResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for SignedFirmwareStatusNotificationResponse {}
impl Response for SignedFirmwareStatusNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignedUpdateFirmwareRequest {
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
pub firmware: Firmware,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retries: Option<i32>,
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retry_interval: Option<i32>,
}
impl SignedUpdateFirmwareRequest {
#[must_use]
pub fn new(request_id: i32, firmware: Firmware) -> Self {
Self {
request_id,
firmware,
retries: None,
retry_interval: None,
}
}
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
}
impl Validate for SignedUpdateFirmwareRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("firmware");
Validate::validate_at(&self.firmware, path, out);
path.pop();
}
}
impl Sealed for SignedUpdateFirmwareRequest {}
impl Request for SignedUpdateFirmwareRequest {
type Action = Action;
const ACTION: Action = Action::SignedUpdateFirmware;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SignedUpdateFirmwareResponse;
}
impl Confirmed for SignedUpdateFirmwareRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignedUpdateFirmwareResponse {
pub status: UpdateFirmwareStatus,
}
impl SignedUpdateFirmwareResponse {
#[must_use]
pub fn new(status: UpdateFirmwareStatus) -> Self {
Self { status }
}
}
impl Validate for SignedUpdateFirmwareResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for SignedUpdateFirmwareResponse {}
impl Response for SignedUpdateFirmwareResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StartTransactionRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
#[serde(rename = "idTag")]
pub id_tag: String,
#[serde(rename = "meterStart")]
pub meter_start: i32,
pub timestamp: crate::types::DateTime,
#[serde(rename = "reservationId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reservation_id: Option<i32>,
}
impl StartTransactionRequest {
#[must_use]
pub fn new(
connector_id: i32,
id_tag: impl Into<String>,
meter_start: i32,
timestamp: impl Into<crate::types::DateTime>,
) -> Self {
Self {
connector_id,
id_tag: id_tag.into(),
meter_start,
timestamp: timestamp.into(),
reservation_id: None,
}
}
#[must_use]
pub fn with_reservation_id(mut self, value: i32) -> Self {
self.reservation_id = Some(value);
self
}
}
impl Validate for StartTransactionRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTag");
validate::string(self.id_tag.as_str(), None, Some(20), path, out);
path.pop();
}
}
impl Sealed for StartTransactionRequest {}
impl Request for StartTransactionRequest {
type Action = Action;
const ACTION: Action = Action::StartTransaction;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = StartTransactionResponse;
}
impl Confirmed for StartTransactionRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StartTransactionResponse {
#[serde(rename = "idTagInfo")]
pub id_tag_info: IdTagInfo,
#[serde(rename = "transactionId")]
pub transaction_id: i32,
}
impl StartTransactionResponse {
#[must_use]
pub fn new(id_tag_info: IdTagInfo, transaction_id: i32) -> Self {
Self {
id_tag_info,
transaction_id,
}
}
}
impl Validate for StartTransactionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTagInfo");
Validate::validate_at(&self.id_tag_info, path, out);
path.pop();
}
}
impl Sealed for StartTransactionResponse {}
impl Response for StartTransactionResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StatusNotificationRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
#[serde(rename = "errorCode")]
pub error_code: ChargePointErrorCode,
pub status: ChargePointStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub info: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub timestamp: Option<crate::types::DateTime>,
#[serde(rename = "vendorId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vendor_id: Option<String>,
#[serde(rename = "vendorErrorCode")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vendor_error_code: Option<String>,
}
impl StatusNotificationRequest {
#[must_use]
pub fn new(
connector_id: i32,
error_code: ChargePointErrorCode,
status: ChargePointStatus,
) -> Self {
Self {
connector_id,
error_code,
status,
info: None,
timestamp: None,
vendor_id: None,
vendor_error_code: None,
}
}
#[must_use]
pub fn with_info(mut self, value: impl Into<String>) -> Self {
self.info = Some(value.into());
self
}
#[must_use]
pub fn with_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
self.timestamp = Some(value.into());
self
}
#[must_use]
pub fn with_vendor_id(mut self, value: impl Into<String>) -> Self {
self.vendor_id = Some(value.into());
self
}
#[must_use]
pub fn with_vendor_error_code(mut self, value: impl Into<String>) -> Self {
self.vendor_error_code = Some(value.into());
self
}
}
impl Validate for StatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("errorCode");
Validate::validate_at(&self.error_code, path, out);
path.pop();
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("info");
if let Some(value) = &self.info {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
path.push_key("vendorId");
if let Some(value) = &self.vendor_id {
validate::string(value.as_str(), None, Some(255), path, out);
}
path.pop();
path.push_key("vendorErrorCode");
if let Some(value) = &self.vendor_error_code {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
}
}
impl Sealed for StatusNotificationRequest {}
impl Request for StatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::StatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = StatusNotificationResponse;
}
impl Confirmed for StatusNotificationRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct StatusNotificationResponse {}
impl StatusNotificationResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for StatusNotificationResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for StatusNotificationResponse {}
impl Response for StatusNotificationResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StopTransactionRequest {
#[serde(rename = "meterStop")]
pub meter_stop: i32,
pub timestamp: crate::types::DateTime,
#[serde(rename = "transactionId")]
pub transaction_id: i32,
#[serde(rename = "idTag")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id_tag: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reason: Option<Reason>,
#[serde(rename = "transactionData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transaction_data: Option<Vec<MeterValue>>,
}
impl StopTransactionRequest {
#[must_use]
pub fn new(
meter_stop: i32,
timestamp: impl Into<crate::types::DateTime>,
transaction_id: i32,
) -> Self {
Self {
meter_stop,
timestamp: timestamp.into(),
transaction_id,
id_tag: None,
reason: None,
transaction_data: None,
}
}
#[must_use]
pub fn with_id_tag(mut self, value: impl Into<String>) -> Self {
self.id_tag = Some(value.into());
self
}
#[must_use]
pub fn with_reason(mut self, value: Reason) -> Self {
self.reason = Some(value);
self
}
#[must_use]
pub fn with_transaction_data(mut self, value: Vec<MeterValue>) -> Self {
self.transaction_data = Some(value);
self
}
}
impl Validate for StopTransactionRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTag");
if let Some(value) = &self.id_tag {
validate::string(value.as_str(), None, Some(20), path, out);
}
path.pop();
path.push_key("reason");
if let Some(value) = &self.reason {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("transactionData");
if let Some(value) = &self.transaction_data {
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
}
}
impl Sealed for StopTransactionRequest {}
impl Request for StopTransactionRequest {
type Action = Action;
const ACTION: Action = Action::StopTransaction;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = StopTransactionResponse;
}
impl Confirmed for StopTransactionRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct StopTransactionResponse {
#[serde(rename = "idTagInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id_tag_info: Option<IdTagInfo>,
}
impl StopTransactionResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn with_id_tag_info(mut self, value: IdTagInfo) -> Self {
self.id_tag_info = Some(value);
self
}
}
impl Validate for StopTransactionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTagInfo");
if let Some(value) = &self.id_tag_info {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for StopTransactionResponse {}
impl Response for StopTransactionResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TriggerMessageRequest {
#[serde(rename = "requestedMessage")]
pub requested_message: MessageTrigger,
#[serde(rename = "connectorId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub connector_id: Option<i32>,
}
impl TriggerMessageRequest {
#[must_use]
pub fn new(requested_message: MessageTrigger) -> Self {
Self {
requested_message,
connector_id: None,
}
}
#[must_use]
pub fn with_connector_id(mut self, value: i32) -> Self {
self.connector_id = Some(value);
self
}
}
impl Validate for TriggerMessageRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("requestedMessage");
Validate::validate_at(&self.requested_message, path, out);
path.pop();
}
}
impl Sealed for TriggerMessageRequest {}
impl Request for TriggerMessageRequest {
type Action = Action;
const ACTION: Action = Action::TriggerMessage;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = TriggerMessageResponse;
}
impl Confirmed for TriggerMessageRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TriggerMessageResponse {
pub status: TriggerMessageStatus,
}
impl TriggerMessageResponse {
#[must_use]
pub fn new(status: TriggerMessageStatus) -> Self {
Self { status }
}
}
impl Validate for TriggerMessageResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for TriggerMessageResponse {}
impl Response for TriggerMessageResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnlockConnectorRequest {
#[serde(rename = "connectorId")]
pub connector_id: i32,
}
impl UnlockConnectorRequest {
#[must_use]
pub fn new(connector_id: i32) -> Self {
Self { connector_id }
}
}
impl Validate for UnlockConnectorRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for UnlockConnectorRequest {}
impl Request for UnlockConnectorRequest {
type Action = Action;
const ACTION: Action = Action::UnlockConnector;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UnlockConnectorResponse;
}
impl Confirmed for UnlockConnectorRequest {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnlockConnectorResponse {
pub status: UnlockStatus,
}
impl UnlockConnectorResponse {
#[must_use]
pub fn new(status: UnlockStatus) -> Self {
Self { status }
}
}
impl Validate for UnlockConnectorResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
}
}
impl Sealed for UnlockConnectorResponse {}
impl Response for UnlockConnectorResponse {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateFirmwareRequest {
pub location: String,
#[serde(rename = "retrieveDate")]
pub retrieve_date: crate::types::DateTime,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub retries: Option<i32>,
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub retry_interval: Option<i32>,
}
impl UpdateFirmwareRequest {
#[must_use]
pub fn new(
location: impl Into<String>,
retrieve_date: impl Into<crate::types::DateTime>,
) -> Self {
Self {
location: location.into(),
retrieve_date: retrieve_date.into(),
retries: None,
retry_interval: None,
}
}
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
}
impl Validate for UpdateFirmwareRequest {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for UpdateFirmwareRequest {}
impl Request for UpdateFirmwareRequest {
type Action = Action;
const ACTION: Action = Action::UpdateFirmware;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UpdateFirmwareResponse;
}
impl Confirmed for UpdateFirmwareRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct UpdateFirmwareResponse {}
impl UpdateFirmwareResponse {
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl Validate for UpdateFirmwareResponse {
fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
}
impl Sealed for UpdateFirmwareResponse {}
impl Response for UpdateFirmwareResponse {}