build: properly workaround Ajv TS type definitions bug
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / 1.6 / Transaction.ts
index 7b072e700155d5f44bc888888e5d523938d7ceff..49cabf2e2e7bb41660c77e4f6dc7273116d71124 100644 (file)
@@ -1,7 +1,7 @@
-import { MeterValue } from './MeterValues';
+import type { OCPP16MeterValue } from './MeterValues.js';
+import type { JsonObject } from '../../JsonType.js';
 
-export enum StopTransactionReason {
-  NONE = '',
+export enum OCPP16StopTransactionReason {
   EMERGENCY_STOP = 'EmergencyStop',
   EV_DISCONNECTED = 'EVDisconnected',
   HARD_RESET = 'HardReset',
@@ -12,45 +12,53 @@ export enum StopTransactionReason {
   REMOTE = 'Remote',
   SOFT_RESET = 'SoftReset',
   UNLOCK_COMMAND = 'UnlockCommand',
-  DE_AUTHORIZED = 'DeAuthorized'
+  DE_AUTHORIZED = 'DeAuthorized',
 }
 
-export enum AuthorizationStatus {
+export enum OCPP16AuthorizationStatus {
   ACCEPTED = 'Accepted',
   BLOCKED = 'Blocked',
   EXPIRED = 'Expired',
   INVALID = 'Invalid',
-  CONCURRENT_TX = 'ConcurrentTx'
+  CONCURRENT_TX = 'ConcurrentTx',
 }
 
-export interface IdTagInfo {
-  status: AuthorizationStatus;
+interface IdTagInfo extends JsonObject {
+  status: OCPP16AuthorizationStatus;
   parentIdTag?: string;
   expiryDate?: Date;
 }
 
-export interface StartTransactionRequest {
+export interface OCPP16AuthorizeRequest extends JsonObject {
+  idTag: string;
+}
+
+export interface OCPP16AuthorizeResponse extends JsonObject {
+  idTagInfo: IdTagInfo;
+}
+
+export interface OCPP16StartTransactionRequest extends JsonObject {
   connectorId: number;
   idTag: string;
   meterStart: number;
+  timestamp: Date;
   reservationId?: number;
-  timestamp: string;
 }
 
-export interface StartTransactionResponse {
+export interface OCPP16StartTransactionResponse extends JsonObject {
   idTagInfo: IdTagInfo;
   transactionId: number;
 }
 
-export interface StopTransactionRequest {
+export interface OCPP16StopTransactionRequest extends JsonObject {
   idTag?: string;
   meterStop: number;
-  timestamp: string;
+  timestamp: Date;
   transactionId: number;
-  reason?: StopTransactionReason;
-  transactionData?: MeterValue[];
+  reason?: OCPP16StopTransactionReason;
+  transactionData?: OCPP16MeterValue[];
 }
 
-export interface StopTransactionResponse {
+export interface OCPP16StopTransactionResponse extends JsonObject {
   idTagInfo?: IdTagInfo;
 }