forked from solidstudiosh/ocpi-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ocpi.commands.ts
42 lines (36 loc) · 989 Bytes
/
ocpi.commands.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { z } from "zod";
import { Token } from "./ocpi.tokens";
export const ReserveNowCommand = z.object({
response_url: z.string().url(),
token: Token,
expiry_date: z.date(),
reservation_id: z.number().int(),
location_id: z.string().max(39),
evse_uid: z.string().max(39).nullish(),
});
export const StartSessionCommand = z.object({
response_url: z.string().url(),
token: Token,
location_id: z.string().max(39),
evse_uid: z.string().max(39).nullish(),
});
export const StopSessionCommand = z.object({
response_url: z.string().url(),
session_id: z.string().max(36),
});
export const UnlockConnectorCommand = z.object({
response_url: z.string().url(),
location_id: z.string().max(39),
evse_uid: z.string().max(39),
connector_id: z.string().max(36),
});
const CommandResponseType = z.enum([
"NOT_SUPPORTED",
"REJECTED",
"ACCEPTED",
"TIMEOUT",
"UNKNOWN_SESSION",
]);
export const CommandResponse = z.object({
result: CommandResponseType,
});