refactor: refine type definitions
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / 1.6 / Requests.ts
1 import type { OCPP16ChargePointErrorCode } from './ChargePointErrorCode.js'
2 import type { OCPP16ChargePointStatus } from './ChargePointStatus.js'
3 import type {
4 OCPP16ChargingProfile,
5 OCPP16ChargingProfilePurposeType,
6 OCPP16ChargingRateUnitType
7 } from './ChargingProfile.js'
8 import type { OCPP16StandardParametersKey, OCPP16VendorParametersKey } from './Configuration.js'
9 import type { OCPP16DiagnosticsStatus } from './DiagnosticsStatus.js'
10 import type { EmptyObject } from '../../EmptyObject.js'
11 import type { JsonObject } from '../../JsonType.js'
12
13 export enum OCPP16RequestCommand {
14 BOOT_NOTIFICATION = 'BootNotification',
15 HEARTBEAT = 'Heartbeat',
16 STATUS_NOTIFICATION = 'StatusNotification',
17 AUTHORIZE = 'Authorize',
18 START_TRANSACTION = 'StartTransaction',
19 STOP_TRANSACTION = 'StopTransaction',
20 METER_VALUES = 'MeterValues',
21 DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
22 FIRMWARE_STATUS_NOTIFICATION = 'FirmwareStatusNotification',
23 DATA_TRANSFER = 'DataTransfer'
24 }
25
26 export enum OCPP16IncomingRequestCommand {
27 RESET = 'Reset',
28 CLEAR_CACHE = 'ClearCache',
29 CHANGE_AVAILABILITY = 'ChangeAvailability',
30 UNLOCK_CONNECTOR = 'UnlockConnector',
31 GET_CONFIGURATION = 'GetConfiguration',
32 CHANGE_CONFIGURATION = 'ChangeConfiguration',
33 GET_COMPOSITE_SCHEDULE = 'GetCompositeSchedule',
34 SET_CHARGING_PROFILE = 'SetChargingProfile',
35 CLEAR_CHARGING_PROFILE = 'ClearChargingProfile',
36 REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
37 REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction',
38 GET_DIAGNOSTICS = 'GetDiagnostics',
39 TRIGGER_MESSAGE = 'TriggerMessage',
40 DATA_TRANSFER = 'DataTransfer',
41 UPDATE_FIRMWARE = 'UpdateFirmware',
42 RESERVE_NOW = 'ReserveNow',
43 CANCEL_RESERVATION = 'CancelReservation'
44 }
45
46 export type OCPP16HeartbeatRequest = EmptyObject
47
48 export interface OCPP16BootNotificationRequest extends JsonObject {
49 chargePointVendor: string
50 chargePointModel: string
51 chargePointSerialNumber?: string
52 chargeBoxSerialNumber?: string
53 firmwareVersion?: string
54 iccid?: string
55 imsi?: string
56 meterType?: string
57 meterSerialNumber?: string
58 }
59
60 export interface OCPP16StatusNotificationRequest extends JsonObject {
61 connectorId: number
62 errorCode: OCPP16ChargePointErrorCode
63 status: OCPP16ChargePointStatus
64 info?: string
65 timestamp?: Date
66 vendorId?: string
67 vendorErrorCode?: string
68 }
69
70 export type OCPP16ClearCacheRequest = EmptyObject
71
72 type OCPP16ConfigurationKey = string | OCPP16StandardParametersKey | OCPP16VendorParametersKey
73
74 export interface ChangeConfigurationRequest extends JsonObject {
75 key: OCPP16ConfigurationKey
76 value: string
77 }
78
79 export interface RemoteStartTransactionRequest extends JsonObject {
80 connectorId: number
81 idTag: string
82 chargingProfile?: OCPP16ChargingProfile
83 }
84
85 export interface RemoteStopTransactionRequest extends JsonObject {
86 transactionId: number
87 }
88
89 export interface UnlockConnectorRequest extends JsonObject {
90 connectorId: number
91 }
92
93 export interface GetConfigurationRequest extends JsonObject {
94 key?: OCPP16ConfigurationKey[]
95 }
96
97 enum ResetType {
98 HARD = 'Hard',
99 SOFT = 'Soft'
100 }
101
102 export interface ResetRequest extends JsonObject {
103 type: ResetType
104 }
105
106 export interface OCPP16GetCompositeScheduleRequest extends JsonObject {
107 connectorId: number
108 duration: number
109 chargingRateUnit?: OCPP16ChargingRateUnitType
110 }
111
112 export interface SetChargingProfileRequest extends JsonObject {
113 connectorId: number
114 csChargingProfiles: OCPP16ChargingProfile
115 }
116
117 export enum OCPP16AvailabilityType {
118 Inoperative = 'Inoperative',
119 Operative = 'Operative'
120 }
121
122 export interface OCPP16ChangeAvailabilityRequest extends JsonObject {
123 connectorId: number
124 type: OCPP16AvailabilityType
125 }
126
127 export interface OCPP16ClearChargingProfileRequest extends JsonObject {
128 id?: number
129 connectorId?: number
130 chargingProfilePurpose?: OCPP16ChargingProfilePurposeType
131 stackLevel?: number
132 }
133
134 export interface OCPP16UpdateFirmwareRequest extends JsonObject {
135 location: string
136 retrieveDate: Date
137 retries?: number
138 retryInterval?: number
139 }
140
141 export enum OCPP16FirmwareStatus {
142 Downloaded = 'Downloaded',
143 DownloadFailed = 'DownloadFailed',
144 Downloading = 'Downloading',
145 Idle = 'Idle',
146 InstallationFailed = 'InstallationFailed',
147 Installing = 'Installing',
148 Installed = 'Installed'
149 }
150
151 export interface OCPP16FirmwareStatusNotificationRequest extends JsonObject {
152 status: OCPP16FirmwareStatus
153 }
154
155 export interface GetDiagnosticsRequest extends JsonObject {
156 location: string
157 retries?: number
158 retryInterval?: number
159 startTime?: Date
160 stopTime?: Date
161 }
162
163 export interface OCPP16DiagnosticsStatusNotificationRequest extends JsonObject {
164 status: OCPP16DiagnosticsStatus
165 }
166
167 export enum OCPP16MessageTrigger {
168 BootNotification = 'BootNotification',
169 DiagnosticsStatusNotification = 'DiagnosticsStatusNotification',
170 FirmwareStatusNotification = 'FirmwareStatusNotification',
171 Heartbeat = 'Heartbeat',
172 MeterValues = 'MeterValues',
173 StatusNotification = 'StatusNotification'
174 }
175
176 export interface OCPP16TriggerMessageRequest extends JsonObject {
177 requestedMessage: OCPP16MessageTrigger
178 connectorId?: number
179 }
180
181 export enum OCPP16DataTransferVendorId {}
182
183 export interface OCPP16DataTransferRequest extends JsonObject {
184 vendorId: string
185 messageId?: string
186 data?: string
187 }
188
189 export interface OCPP16ReserveNowRequest extends JsonObject {
190 connectorId: number
191 expiryDate: Date
192 idTag: string
193 parentIdTag?: string
194 reservationId: number
195 }
196
197 export interface OCPP16CancelReservationRequest extends JsonObject {
198 reservationId: number
199 }