build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Responses.ts
CommitLineData
69074173 1import type { OCPP16MeterValuesResponse } from './1.6/MeterValues';
e7aeea18
JB
2import {
3 OCPP16AvailabilityStatus,
edd13439 4 type OCPP16BootNotificationResponse,
e7aeea18
JB
5 OCPP16ChargingProfileStatus,
6 OCPP16ClearChargingProfileStatus,
7 OCPP16ConfigurationStatus,
edd13439 8 type OCPP16DataTransferResponse,
91a7d3ea 9 OCPP16DataTransferStatus,
c9a4f9ea
JB
10 type OCPP16DiagnosticsStatusNotificationResponse,
11 type OCPP16FirmwareStatusNotificationResponse,
edd13439 12 type OCPP16HeartbeatResponse,
db652e1e 13 OCPP16ReservationStatus,
edd13439 14 type OCPP16StatusNotificationResponse,
e7aeea18
JB
15 OCPP16TriggerMessageStatus,
16 OCPP16UnlockStatus,
69074173 17} from './1.6/Responses';
e1d9a0f4 18import type { OCPP20BootNotificationResponse, OCPP20ClearCacheResponse } from './2.0/Responses';
69074173
JB
19import type { ErrorType } from './ErrorType';
20import type { MessageType } from './MessageType';
21import type { ChargingStation } from '../../charging-station';
e1d9a0f4 22import type { JsonObject, JsonType } from '../JsonType';
d1888640 23
5cc4b63b 24export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType];
b3ec7bc1 25
5cc4b63b 26export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType];
b3ec7bc1 27
e7aeea18 28export type ResponseHandler = (
08f130a0 29 chargingStation: ChargingStation,
5cc4b63b 30 payload: JsonType,
5edd8ba0 31 requestPayload?: JsonType,
e7aeea18 32) => void | Promise<void>;
58144adb 33
d270cc87
JB
34export type BootNotificationResponse =
35 | OCPP16BootNotificationResponse
36 | OCPP20BootNotificationResponse;
c0560973 37
f22266fd
JB
38export type HeartbeatResponse = OCPP16HeartbeatResponse;
39
f03e1042 40export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse;
22e0d48e 41
e1d9a0f4 42export type StatusNotificationResponse = OCPP16StatusNotificationResponse;
f22266fd
JB
43
44export type MeterValuesResponse = OCPP16MeterValuesResponse;
45
91a7d3ea
JB
46export type DataTransferResponse = OCPP16DataTransferResponse;
47
c9a4f9ea
JB
48export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse;
49
50export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
51
f03e1042 52export enum GenericStatus {
6b635033
JB
53 Accepted = 'Accepted',
54 Rejected = 'Rejected',
9ccca265
JB
55}
56
e1d9a0f4 57export interface GenericResponse extends JsonObject {
f03e1042 58 status: GenericStatus;
e1d9a0f4 59}
9ccca265 60
d270cc87
JB
61export enum RegistrationStatusEnumType {
62 ACCEPTED = 'Accepted',
63 PENDING = 'Pending',
64 REJECTED = 'Rejected',
65}
9ccca265
JB
66
67export const AvailabilityStatus = {
e7aeea18 68 ...OCPP16AvailabilityStatus,
edd13439
JB
69} as const;
70export type AvailabilityStatus = OCPP16AvailabilityStatus;
9ccca265
JB
71
72export const ChargingProfileStatus = {
e7aeea18 73 ...OCPP16ChargingProfileStatus,
edd13439
JB
74} as const;
75export type ChargingProfileStatus = OCPP16ChargingProfileStatus;
9ccca265
JB
76
77export const ClearChargingProfileStatus = {
e7aeea18 78 ...OCPP16ClearChargingProfileStatus,
edd13439
JB
79} as const;
80export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus;
9ccca265
JB
81
82export const ConfigurationStatus = {
e7aeea18 83 ...OCPP16ConfigurationStatus,
edd13439
JB
84} as const;
85export type ConfigurationStatus = OCPP16ConfigurationStatus;
9ccca265
JB
86
87export const UnlockStatus = {
e7aeea18 88 ...OCPP16UnlockStatus,
edd13439
JB
89} as const;
90export type UnlockStatus = OCPP16UnlockStatus;
802cfa13
JB
91
92export const TriggerMessageStatus = {
e7aeea18 93 ...OCPP16TriggerMessageStatus,
edd13439
JB
94} as const;
95export type TriggerMessageStatus = OCPP16TriggerMessageStatus;
91a7d3ea
JB
96
97export const DataTransferStatus = {
98 ...OCPP16DataTransferStatus,
edd13439
JB
99} as const;
100export type DataTransferStatus = OCPP16DataTransferStatus;
db652e1e
JB
101
102export type ReservationStatus = OCPP16ReservationStatus;
db652e1e
JB
103export const ReservationStatus = {
104 ...OCPP16ReservationStatus,
105};
106
b1f1b0f6 107export type CancelReservationStatus = GenericStatus;
db652e1e 108export const CancelReservationStatus = {
66dd3447 109 ...GenericStatus,
db652e1e 110};
66dd3447 111
b1f1b0f6 112export type CancelReservationResponse = GenericResponse;