-
Notifications
You must be signed in to change notification settings - Fork 2
/
ocpi.tokens.v221.ts
34 lines (29 loc) · 1.04 KB
/
ocpi.tokens.v221.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
import {z} from "zod";
import { TokenType } from "./ocpi.common.v221";
import { ProfileType } from "./ocpi.sessions.v221";
const WhitelistType = z.enum(["ALWAYS", "ALLOWED", "ALLOWED_OFFLINE", "NEVER"]);
const EnergyContract = z.object({
supplier_name: z.string().max(64),
contract_id: z.string().max(64).nullish(),
})
export const LocationReferences = z.object({
location_id: z.string().max(36).nullish(),
evse_uids: z.array(z.string().max(36)).nullish(),
})
export const Token = z.object({
country_code: z.string().length(2),
party_id: z.string().max(3),
uid: z.string().max(36),
type: TokenType,
contract_id: z.string().max(36),
visual_number: z.string().max(64).nullish(),
issuer: z.string().max(64),
group_id: z.string().max(36).nullish(),
valid: z.boolean(),
whitelist: WhitelistType,
language: z.string().length(2).nullish(),
default_profile_type: ProfileType.nullish(),
energy_contract: EnergyContract.nullish(),
last_updated: z.date(),
})
export const Tokens = z.array(Token);