rust_ocpp/v1_6/messages/
reserve_now.rs

1use chrono::{DateTime, Utc};
2
3use validator::Validate;
4
5use crate::v1_6::types::ReservationStatus;
6
7/// This contains the field definition of the ReserveNow.req PDU sent by the Central System to the Charge Point. See also Reserve Now
8#[derive(serde::Serialize, serde::Deserialize, Validate, Debug, Clone, PartialEq, Default)]
9#[serde(rename_all = "camelCase")]
10pub struct ReserveNowRequest {
11    /// Required. This contains the id of the connector to be reserved. A value of 0 means that the reservation is not for a specific connector.
12    pub connector_id: u32,
13    /// Required. This contains the date and time when the reservation ends.
14    pub expiry_date: DateTime<Utc>,
15    /// Required. The identifier for which the Charge Point has to reserve a connector.
16    #[validate(length(min = 1, max = 20))]
17    pub id_tag: String, // IdToken, should this be a type?
18    /// Optional. The parent idTag.
19    #[validate(length(min = 1, max = 20))]
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub parent_id_tag: Option<String>, // IdToken, shoult this be a type?
22    /// Required. Unique id for this reservation.
23    pub reservation_id: i32,
24}
25
26/// This contains the field definitions of the RemoteStopTransactionResponse PDU sent from Charge Point to Central System. See also Remote Stop Transaction
27#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
28#[serde(rename_all = "camelCase")]
29pub struct ReserveNowResponse {
30    // Required. Status indicating whether Charge Point accepts the request to stop a transaction.
31    pub status: ReservationStatus,
32}