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