fix: fix circular dependencies in types
[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';
73ed6e01 19import { type GenericResponse, GenericStatus } from './Common';
69074173
JB
20import type { ErrorType } from './ErrorType';
21import type { MessageType } from './MessageType';
22import type { ChargingStation } from '../../charging-station';
73ed6e01 23import type { JsonType } from '../JsonType';
d1888640 24
5cc4b63b 25export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType];
b3ec7bc1 26
5cc4b63b 27export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType];
b3ec7bc1 28
e7aeea18 29export type ResponseHandler = (
08f130a0 30 chargingStation: ChargingStation,
5cc4b63b 31 payload: JsonType,
5edd8ba0 32 requestPayload?: JsonType,
e7aeea18 33) => void | Promise<void>;
58144adb 34
d270cc87
JB
35export type BootNotificationResponse =
36 | OCPP16BootNotificationResponse
37 | OCPP20BootNotificationResponse;
c0560973 38
f22266fd
JB
39export type HeartbeatResponse = OCPP16HeartbeatResponse;
40
f03e1042 41export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse;
22e0d48e 42
e1d9a0f4 43export type StatusNotificationResponse = OCPP16StatusNotificationResponse;
f22266fd
JB
44
45export type MeterValuesResponse = OCPP16MeterValuesResponse;
46
91a7d3ea
JB
47export type DataTransferResponse = OCPP16DataTransferResponse;
48
c9a4f9ea
JB
49export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse;
50
51export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
52
9ccca265 53export const AvailabilityStatus = {
e7aeea18 54 ...OCPP16AvailabilityStatus,
edd13439
JB
55} as const;
56export type AvailabilityStatus = OCPP16AvailabilityStatus;
9ccca265
JB
57
58export const ChargingProfileStatus = {
e7aeea18 59 ...OCPP16ChargingProfileStatus,
edd13439
JB
60} as const;
61export type ChargingProfileStatus = OCPP16ChargingProfileStatus;
9ccca265
JB
62
63export const ClearChargingProfileStatus = {
e7aeea18 64 ...OCPP16ClearChargingProfileStatus,
edd13439
JB
65} as const;
66export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus;
9ccca265
JB
67
68export const ConfigurationStatus = {
e7aeea18 69 ...OCPP16ConfigurationStatus,
edd13439
JB
70} as const;
71export type ConfigurationStatus = OCPP16ConfigurationStatus;
9ccca265
JB
72
73export const UnlockStatus = {
e7aeea18 74 ...OCPP16UnlockStatus,
edd13439
JB
75} as const;
76export type UnlockStatus = OCPP16UnlockStatus;
802cfa13
JB
77
78export const TriggerMessageStatus = {
e7aeea18 79 ...OCPP16TriggerMessageStatus,
edd13439
JB
80} as const;
81export type TriggerMessageStatus = OCPP16TriggerMessageStatus;
91a7d3ea
JB
82
83export const DataTransferStatus = {
84 ...OCPP16DataTransferStatus,
edd13439
JB
85} as const;
86export type DataTransferStatus = OCPP16DataTransferStatus;
db652e1e
JB
87
88export type ReservationStatus = OCPP16ReservationStatus;
db652e1e
JB
89export const ReservationStatus = {
90 ...OCPP16ReservationStatus,
73ed6e01 91} as const;
db652e1e 92
b1f1b0f6 93export type CancelReservationStatus = GenericStatus;
db652e1e 94export const CancelReservationStatus = {
66dd3447 95 ...GenericStatus,
73ed6e01 96} as const;
66dd3447 97
b1f1b0f6 98export type CancelReservationResponse = GenericResponse;