1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use super::{
AuthMethod, CdrToken, ChargingPeriod, CiString, CsString, DateTime, Price, SessionStatus,
};
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Session {
/// ISO-3166 alpha-2 country code of the CPO that 'owns' this
/// Session
pub country_code: CiString<2>,
/// CPO ID of the CPO that 'owns' this Session (following the ISO-
/// 15118 standard).
pub party_id: CiString<3>,
/// The unique id that identifies the charging session in the CPO
/// platform.
pub id: CiString<36>,
/// The timestamp when the session became ACTIVE in the Charge Point.
/// When the session is still PENDING, this field SHALL be set to the
/// time the Session was created at the Charge Point. When a Session
/// goes from PENDING to ACTIVE, this field SHALL be update to the
/// moment the Session went to ACTIVE in the Charge Point.
pub start_date_time: DateTime,
/// The timestamp when the session was completed/finished, charging
/// might have finished before the session ends, for example: EV is full,
/// but parking cost also has to be paid.
pub end_date_time: Option<DateTime>,
/// How many kWh were charged.
pub kwh: f64,
/// Token used to start this charging session, including all the relevant
/// information to identify the unique token.
pub cdr_token: CdrToken,
/// Method used for authentication.
pub auth_method: AuthMethod,
/// Reference to the authorization given by the eMSP. When the eMSP
/// provided an authorization_reference in either: real-time
/// authorization or StartSession, this field SHALL contain the same
/// value. When different authorization_reference values have
/// been given by the eMSP that are relevant to this Session, the last
/// given value SHALL be used here.
pub authorization_reference: Option<CiString<36>>,
/// Location.id of the Location object of this CPO, on which the
/// charging session is/was happening.
pub location_id: CiString<36>,
/// EVSE.uid of the EVSE of this Location on which the charging
/// session is/was happening.
pub evse_uid: CiString<36>,
/// Optional identification of the kWh meter.
pub meter_id: Option<CsString<255>>,
/// ISO 4217 code of the currency used for this session.
pub currency: CsString<3>,
/// An optional list of Charging Periods that can be used to calculate
/// and verify the total cost.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub charging_periods: Vec<ChargingPeriod>,
/// The total cost of the session in the specified currency. This is the
/// price that the eMSP will have to pay to the CPO. A total_cost of
/// 0.00 means free of charge. When omitted, i.e. no price information
/// is given in the Session object, it does not imply the session is/was
/// free of charge.
pub total_cost: Option<Price>,
/// The status of the session.
pub status: SessionStatus,
/// Timestamp when this Session was last updated (or created).
pub last_updated: DateTime,
}