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