-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathParking.ts
More file actions
108 lines (95 loc) · 3.37 KB
/
Copy pathParking.ts
File metadata and controls
108 lines (95 loc) · 3.37 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { SchemaDefinition } from '@sozialhelden/simpl-schema';
import { getPrefixedQuantitySchemaDefinition, Length, LengthSchema } from './Quantity.js';
import { getLocalizedStringSchemaDefinition, LocalizedString } from './LocalizedString.js';
import getPrefixedSchemaDefinition from './lib/getPrefixedSchemaDefinition.js';
import { getStructuredAddressSchemaDefinition } from './Address.js';
import BooleanField from './BooleanField.js';
import { getInteractableSchemaDefinition, Interactable } from './Interactable.js';
export const ParkingInteractions = [
'park',
'enterVehicle',
'exitVehicle',
'arrive',
] as const;
export type ParkingInteraction = typeof ParkingInteractions[number];
export const ParkingInteractionsSet = new Set(ParkingInteractions);
/**
* Describes one or more wheelchair parking lots.
*/
export interface WheelchairParking extends Interactable<ParkingInteraction> {
/**
* Describes where the parking is located.
*/
location?: LocalizedString;
/**
* How far away is the parking from the main entrance? If there is a separate wheelchair entrance,
* the distance to this entrance MUST be used.
*/
distanceToEntrance?: Length;
/**
* Defines many wheelchair accessible parking lots are provided
*/
count?: number; // TODO use something for >10
/**
* `true` if the parking is inside a building or under a roof, `false` if not, `undefined` if
* unknown.
*/
isLocatedInside?: boolean;
/**
* Width constraint of the parking lots.
*/
width?: Length;
/**
* Length constraint of the parking lots.
*/
length?: Length;
/**
* Maximal allowed vehicle height for users of this parking.
*/
maxVehicleHeight?: Length;
/**
* `true` if there is dedicated signage at all relevant turning points from the street to the
* parking, `false` if not, `undefined` if this is unknown.
*/
hasDedicatedSignage?: boolean;
/**
* List of permit names that allow using this parking.
*
* @example <code>[{ en: 'Blue Badge' }, { en: 'Red badge' }, { en: 'Turqouise badge' }]</code>
*/
neededParkingPermits?: LocalizedString[];
}
export const getWheelchairParkingSchemaDefinition: () => SchemaDefinition = () => ({
...getLocalizedStringSchemaDefinition('location'),
...getPrefixedQuantitySchemaDefinition('distanceToEntrance', LengthSchema),
count: {
type: Number,
optional: true,
min: 0,
},
isLocatedInside: BooleanField,
...getPrefixedQuantitySchemaDefinition('width', LengthSchema),
...getPrefixedQuantitySchemaDefinition('length', LengthSchema),
...getPrefixedQuantitySchemaDefinition('maxVehicleHeight', LengthSchema),
hasDedicatedSignage: BooleanField,
neededParkingPermits: {
type: Array,
optional: true,
},
...getLocalizedStringSchemaDefinition('neededParkingPermits.$', {}),
...getInteractableSchemaDefinition(ParkingInteractionsSet),
});
export interface Parking extends Interactable<ParkingInteraction> {
count?: number;
forWheelchairUsers?: WheelchairParking | null;
}
export const getParkingSchemaDefinition: () => SchemaDefinition = () => ({
...getPrefixedSchemaDefinition('forWheelchairUsers', getWheelchairParkingSchemaDefinition()),
count: {
type: 'SimpleSchema.Integer',
optional: true,
min: 0,
},
...getPrefixedSchemaDefinition('address', getStructuredAddressSchemaDefinition()),
...getInteractableSchemaDefinition(ParkingInteractionsSet),
});