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