-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSeat.ts
More file actions
237 lines (215 loc) · 6.13 KB
/
Copy pathSeat.ts
File metadata and controls
237 lines (215 loc) · 6.13 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
import { SchemaDefinition } from '@sozialhelden/simpl-schema';
import {
Direction, DirectionAxes, DirectionAxis, Directions,
} from './ActionMode.js';
import BooleanField from './BooleanField.js';
import { getInteractableSchemaDefinition, Interactable } from './Interactable.js';
import { getIntercomSchemaDefinition, Intercom } from './Intercom.js';
import getPrefixedSchemaDefinition from './lib/getPrefixedSchemaDefinition.js';
import { getLocalizedStringSchemaDefinition, LocalizedString } from './LocalizedString.js';
import { getPaymentSchemaDefinition, Payment } from './Payment.js';
import { getPersonalProfileSchemaDefinition, PersonalProfile } from './PersonalProfile.js';
import {
getPrefixedQuantitySchemaDefinition, Length, LengthSchema,
} from './Quantity.js';
export const SeatInteractions = [
'sit',
'fold',
'unfold',
'move',
'adjust',
'adjustHeight',
'adjustSeatingSurface',
'adjustSeatingAngle',
'adjustArmRests',
'removeArmrests',
'adjustHeadRest',
'adjustLegRest',
'adjustBackRest',
'adjustFootRest',
'adjustSeatBelt',
'adjustSeatBeltLength',
'adjustSeatBeltHeight',
'adjustSeatBeltAngle',
'adjustSeatBeltPosition',
'adjustSeatBeltTension',
'adjustSeatBeltLock',
'connectSeatbelt',
] as const;
export type SeatInteraction = typeof SeatInteractions[number];
export const SeatInteractionsSet = new Set(SeatInteractions);
/**
* Describes one or multiple seats / chairs / benches / stools / couches / sofas / armchairs / ...
*/
export interface Seat extends Interactable<SeatInteraction> {
/**
* Name of the entrance (helpful if there are multiple entrances).
*/
name?: LocalizedString;
/**
* Name of the entrance (helpful if there are multiple entrances).
*/
description?: LocalizedString;
/**
* The seat is located at the front row of the seating arrangement.
*/
isFrontRow?: boolean;
/**
* The seat is located at the last row of the seating arrangement.
*/
isLastRow?: boolean;
/**
* The seat is located at the center of the seating arrangement, laterally.
*/
isCenterColumn?: boolean;
/**
* The seat row numbers. This is only for seats in a fixed seating arrangement.
*/
rows?: number[];
/**
* The seat column numbers. This is only for seats in a fixed seating arrangement.
*/
columns?: number[];
/**
* The seat is wheelchair accessible.
*/
isWheelchairAccessible?: boolean;
/**
* The seat can be folded.
*/
isFoldable?: boolean;
/**
* The seat is mobile.
*/
isMobile?: boolean;
/**
* The seat is fixed.
*/
isFixed?: boolean;
/**
* The seat has a seatbelt.
*/
hasSeatbelt?: boolean;
/**
* The number of seatbelt points.
*/
seatbeltPoints?: number;
/**
* The seat has a headrest.
*/
hasHeadRest?: boolean;
/**
* The seat can be adjusted in the following axes.
*/
adjustmentAxes?: DirectionAxis[];
/**
* The seat can be adjusted in the following directions.
*/
adjustmentDirections?: Direction[];
/**
* The seat has an adjustable seating surface.
*/
hasAdjustableHeight?: boolean;
/**
* The seat has removable armrests.
*/
hasRemovableArmRests?: boolean;
/**
* How high is the desk? For variable-height desks, use `minimalHeight` and `maximalHeight`
* instead.
*
* This can be used to determine if a wheelchair user can sit at the desk.
*/
fixedHeight?: Length;
/**
* How high is the desk minimally? This is only for variable-height desks. Use `fixedHeight` for
* fixed-height desks.
* This can be used to determine if a wheelchair user can sit at the desk.
*/
minimalHeight?: Length;
/**
* How high is the desk maximally? This is only for variable-height desks. Use `fixedHeight` for
* fixed-height desks.
* This can be used to determine if a wheelchair user can sit at the desk.
*/
maximalHeight?: Length;
/**
* How much space is there in front of the desk?
* This can be used to determine if a wheelchair user can sit at the desk.
*/
turningSpaceInFront?: Length;
/**
* Information about payment at this seat or the cost of using this seat.
*
* `null` indicates there is no payment possible/required.
*/
payment?: Payment | null;
/**
* Information about an intercom at this seat, if applicable.
*
* `null` indicates there is no intercom.
*/
intercom?: Intercom | null;
/**
* The seat is reserved for persons with the given profile.
*/
reservedForPersonsWith?: PersonalProfile;
}
export const getSeatSchemaDefinition: () => SchemaDefinition = () => ({
...getLocalizedStringSchemaDefinition('name'),
...getLocalizedStringSchemaDefinition('description'),
isFrontRow: BooleanField,
isLastRow: BooleanField,
isCenterColumn: BooleanField,
isWheelchairAccessible: BooleanField,
...getPrefixedSchemaDefinition('reservedForPersonsWith', getPersonalProfileSchemaDefinition()),
isFoldable: BooleanField,
isMobile: BooleanField,
isFixed: BooleanField,
hasHeadRest: BooleanField,
hasSeatbelt: BooleanField,
hasAdjustableHeight: BooleanField,
hasRemovableArmRests: BooleanField,
adjustmentAxes: {
type: Array,
optional: true,
},
'adjustmentAxes.$': {
type: String,
allowedValues: (DirectionAxes as any) as any[],
},
adjustmentDirections: {
type: Array,
optional: true,
},
'adjustmentDirections.$': {
type: String,
allowedValues: (Directions as any) as any[],
},
seatbeltPoints: {
type: Number,
optional: true,
min: 1,
},
rows: {
type: Array,
optional: true,
},
'rows.$': {
type: String,
},
columns: {
type: Array,
optional: true,
},
'columns.$': {
type: String,
},
...getPrefixedQuantitySchemaDefinition('fixedHeight', LengthSchema),
...getPrefixedQuantitySchemaDefinition('minimalHeight', LengthSchema),
...getPrefixedQuantitySchemaDefinition('maximalHeight', LengthSchema),
...getPrefixedQuantitySchemaDefinition('turningSpaceInFront', LengthSchema),
...getPrefixedSchemaDefinition('payment', getPaymentSchemaDefinition()),
...getPrefixedSchemaDefinition('intercom', getIntercomSchemaDefinition()),
...getInteractableSchemaDefinition(SeatInteractionsSet),
});