-
Notifications
You must be signed in to change notification settings - Fork 0
/
anyEvent.ts
414 lines (413 loc) · 11.3 KB
/
anyEvent.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
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
import * as EventFactory from '../event';
import { EventType } from '../eventType';
import { IMultilingualString } from '../multilingualString';
import * as OfferFactory from '../offer';
import { OfferType } from '../offerType';
import { OrganizationType } from '../organizationType';
import { PlaceType } from '../placeType';
import { IServiceType as IProductServiceType, ProductType } from '../product';
import * as ReservationFactory from '../reservation';
import { ReservationType } from '../reservationType';
import * as WebAPIFactory from '../service/webAPI';
// import { IThing } from '../thing';
import { ITripWithDetails as IBusTrip } from '../trip/busTrip';
/**
* 予約集計
*/
export interface IAggregateReservation {
typeOf: 'AggregateReservation';
aggregateDate: Date;
checkInCount?: number;
attendeeCount?: number;
reservationCount?: number;
useActionCount?: number;
}
/**
* 予約集計つきオファー
*/
// export interface IOfferWithAggregateReservation extends Pick<IThing, 'name'> {
export interface IOfferWithAggregateReservation {
typeOf: OfferType.Offer;
id: string;
identifier: string;
aggregateReservation?: Pick<IAggregateReservation, 'typeOf' | 'attendeeCount' | 'checkInCount' | 'reservationCount'>;
category?: OfferFactory.ICategory;
maximumAttendeeCapacity?: number;
remainingAttendeeCapacity?: number;
}
/**
* オファー集計
*/
export interface IAggregateOffer {
typeOf: OfferType.AggregateOffer;
aggregateDate: Date;
offerCount?: number;
offers?: IOfferWithAggregateReservation[];
}
export interface IAggregateOfferOfPlace {
typeOf: OfferType.AggregateOffer;
offers?: {
typeOf: OfferType.Offer;
id: string;
identifier?: string;
category?: OfferFactory.ICategory;
aggregateReservation?: Pick<IAggregateReservation, 'typeOf' | 'useActionCount'>;
}[];
}
export interface IPlaceWithAggregateOffer {
typeOf: PlaceType;
identifier?: string;
aggregateOffer?: IAggregateOfferOfPlace;
}
/**
* 入場ゲート集計
*/
export interface IAggregateEntranceGate {
typeOf: PlaceType.AggregatePlace;
aggregateDate: Date;
places: IPlaceWithAggregateOffer[];
}
/**
* 予約対象
* 現時点でBusTripのみ
*/
export type IReservationFor = Pick<IBusTrip, 'arrivalBusStop' | 'arrivalTime' | 'busName' | 'busNumber' | 'departureBusStop' | 'departureTime' | 'identifier' | 'typeOf'>;
export interface IServiceOutput {
typeOf: ReservationType.BusReservation;
reservationFor: IReservationFor;
reservedTicket?: {
typeOf: ReservationFactory.TicketType;
/**
* チケットに割り当てられる座席
* 指定席でない場合、存在しない
*/
ticketedSeat?: {
typeOf: PlaceType.Seat;
};
};
}
export type IServiceType = IProductServiceType & {
id?: string;
};
/**
* 旅客サービス
*/
export interface IItemOffered {
id: string;
/**
* プロダクト名称
*/
name?: { ja?: string };
/**
* サービス区分
*/
serviceType?: IServiceType;
/**
* サービスアウトプット
*/
serviceOutput: IServiceOutput;
typeOf: ProductType.Transportation;
// serviceLocationを追加(2023-01-06~)
availableChannel: ReservationFactory.IServiceChannel;
}
export type IOfferedThrough = WebAPIFactory.IService<WebAPIFactory.Identifier.Chevre>;
export interface ISellerMakesOffer extends Pick<
OfferFactory.IOffer,
'typeOf' | 'availableAtOrFrom' | 'availabilityEnds' | 'availabilityStarts' | 'validFrom' | 'validThrough'
> {
availabilityEnds: Date;
availabilityStarts: Date;
validFrom: Date;
validThrough: Date;
}
export interface ISeller {
typeOf: OrganizationType.Corporation;
/**
* 販売者ID
*/
id: string;
name?: IMultilingualString;
/**
* アプリケーションごとのオファー
*/
makesOffer: ISellerMakesOffer[]; // アプリケーション対応(2022-11-18~)
}
export import IEligibleQuantity = OfferFactory.IEligibleQuantity;
/**
* イベントに対するオファー
*/
export interface IOffer {
typeOf: OfferType.Offer;
/**
* 情報提供終了日時(オンライン取引アプリケーションの設定)
* @deprecated Use seller.makesOffer
*/
availabilityEnds: Date;
/**
* 情報提供開始日時(オンライン取引アプリケーションの設定)
* @deprecated Use seller.makesOffer
*/
availabilityStarts: Date;
eligibleQuantity: IEligibleQuantity;
itemOffered: IItemOffered;
/**
* オファー供給サービス
*/
offeredThrough?: IOfferedThrough;
/**
* 販売可能期間from(オンライン取引アプリケーションの設定)
* @deprecated Use seller.makesOffer
*/
validFrom: Date;
/**
* 販売可能期間through(オンライン取引アプリケーションの設定)
* @deprecated Use seller.makesOffer
*/
validThrough: Date;
unacceptedPaymentMethod?: EventFactory.IUnacceptedPaymentMethodType[];
seller: ISeller;
}
export interface ILocation {
typeOf: PlaceType.ScreeningRoom;
/**
* ルームコード
*/
branchCode: string;
/**
* 場所名称
*/
name?: IMultilingualString;
alternateName?: IMultilingualString;
description?: IMultilingualString;
address?: IMultilingualString;
/**
* イベント固有のキャパシティ
* 施設のキャパシティに依存しない場合に使用
*/
maximumAttendeeCapacity?: number;
}
export type IName = IMultilingualString;
export interface IOrganizer {
id: string;
}
/**
* イベント属性
*/
export interface IAttributes extends Pick<
EventFactory.IAttributes<EventType.Event>,
'additionalProperty' | 'project' | 'identifier' | 'description' | 'eventStatus' | 'maximumAttendeeCapacity' | 'remainingAttendeeCapacity' | 'location'
| 'name' | 'doorTime' | 'endDate' | 'startDate' | 'typeOf'
> {
/**
* 上映場所
*/
location: ILocation;
/**
* イベント名称
*/
name: IName;
/**
* 開場日時
* ISO 8601 date format
*/
doorTime?: Date;
/**
* 終了日時(
* ISO 8601 date format
*/
endDate: Date;
/**
* 開始日時
* ISO 8601 date format
*/
startDate: Date;
/**
* 販売情報
*/
offers: IOffer;
/**
* 発券数
*/
checkInCount?: Number;
/**
* 参加数
*/
attendeeCount?: Number;
/**
* 入場ゲート集計
*/
// aggregateEntranceGate?: IAggregateEntranceGate; // 廃止(2024-03-27~)
/**
* 予約集計
*/
aggregateReservation?: IAggregateReservation;
/**
* オファー集計
*/
// aggregateOffer?: IAggregateOffer; // 廃止(2024-03-27~)
// 必須化(2023-07-12~)
organizer: IOrganizer;
}
/**
* イベント
*/
export type IEvent = EventFactory.IEvent<IAttributes>;
export type ILocation4create = Pick<ILocation, 'branchCode' | 'maximumAttendeeCapacity'>;
export type ISeller4create = Pick<
ISeller,
'makesOffer'
> & {
/**
* POS以外のアプリケーションの共通設定
*/
makesOfferDefault?: Pick<ISellerMakesOffer, 'typeOf' | 'availabilityEnds' | 'availabilityStarts' | 'validFrom' | 'validThrough'>;
};
export interface IAvailableChannel4create {
serviceLocation: {
/**
* ルームコード
*/
branchCode: string;
containedInPlace: {
/**
* 施設ID
*/
id: string;
};
};
}
export type IReservationFor4create = Pick<IReservationFor, 'identifier'>;
export type IServiceOutput4create = Pick<IServiceOutput, 'reservedTicket' | 'typeOf'> & {
reservationFor: IReservationFor4create;
};
export type IItemOffered4create = Pick<IItemOffered, 'id'> & {
availableChannel: IAvailableChannel4create;
serviceOutput: IServiceOutput4create;
};
export type IOffers4create = Pick<IOffer, 'unacceptedPaymentMethod'> & {
/**
* 最大予約数を指定
*/
eligibleQuantity: Pick<IEligibleQuantity, 'maxValue'>;
/**
* 興行IDと座席有無を指定
*/
itemOffered: IItemOffered4create;
/**
* 販売者IDとアプリケーション設定
*/
seller: ISeller4create;
};
export type ICreateParams = Pick<
IAttributes,
'project' | 'typeOf' | 'doorTime' | 'startDate' | 'endDate' | 'eventStatus' | 'additionalProperty'
> & {
/**
* ルームコードとキャパシティを指定
*/
location: ILocation4create;
offers: IOffers4create;
};
/**
* イベント更新パラメータ
*/
export type IUpdateParams = ICreateParams;
/**
* ソート条件
*/
export type ISortOrder = EventFactory.ISortOrder;
export interface IOfferSearchConditions {
/**
* apiリクエストクライアントがseller.makesOffer.$elemMatchに含まれるものを検索
*/
availableFrom?: Date;
/**
* apiリクエストクライアントがseller.makesOffer.$elemMatchに含まれるものを検索
*/
availableThrough?: Date;
/**
* apiリクエストクライアントがseller.makesOffer.$elemMatchに含まれるものを検索
*/
validFrom?: Date;
/**
* apiリクエストクライアントがseller.makesOffer.$elemMatchに含まれるものを検索
*/
validThrough?: Date;
itemOffered?: {
id?: { $in?: string[] };
serviceType?: {
ids?: string[];
};
serviceOutput?: {
reservationFor?: {
arrivalBusStop?: {
/**
* ターミナルコード
*/
branchCode?: { $eq?: string };
};
departureBusStop?: {
/**
* ターミナルコード
*/
branchCode?: { $eq?: string };
};
/**
* トリップコード
*/
identifier?: { $eq?: string };
};
reservedTicket?: {
ticketedSeat?: {
typeOfs?: string[];
};
};
};
typeOf?: {
$eq?: ProductType;
};
};
seller?: {
makesOffer?: {
$elemMatch?: {
availabilityEnds?: {
$gte?: Date;
$lte?: Date;
};
availabilityStarts?: {
$gte?: Date;
$lte?: Date;
};
validFrom?: {
$gte?: Date;
$lte?: Date;
};
validThrough?: {
$gte?: Date;
$lte?: Date;
};
'availableAtOrFrom.id'?: {
$eq?: string;
};
};
};
};
}
/**
* イベント検索条件
*/
export interface ISearchConditions extends EventFactory.ISearchConditions<EventType.Event> {
location?: {
/**
* ルームコード
*/
branchCode?: {
$eq?: string;
$in?: string[];
};
};
/**
* 販売情報
*/
offers?: IOfferSearchConditions;
}