Use eslint extension for import sorting instead of unmaintained external ones
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPResponseService.ts
CommitLineData
5cc4b63b 1import { JsonType } from '../../types/JsonType';
c0560973 2import { RequestCommand } from '../../types/ocpp/Requests';
8114d10e 3import type ChargingStation from '../ChargingStation';
c0560973
JB
4
5export default abstract class OCPPResponseService {
08f130a0 6 private static instance: OCPPResponseService | null = null;
10068088 7
08f130a0
JB
8 protected constructor() {
9 // This is intentional
c0560973
JB
10 }
11
08f130a0
JB
12 public static getInstance<T extends OCPPResponseService>(this: new () => T): T {
13 if (!OCPPResponseService.instance) {
14 OCPPResponseService.instance = new this();
9f2e3130 15 }
08f130a0 16 return OCPPResponseService.instance as T;
9f2e3130
JB
17 }
18
f7f98c68 19 public abstract responseHandler(
08f130a0 20 chargingStation: ChargingStation,
e7aeea18 21 commandName: RequestCommand,
5cc4b63b
JB
22 payload: JsonType,
23 requestPayload: JsonType
e7aeea18 24 ): Promise<void>;
c0560973 25}