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