@pulsecharterconnect/types 0.2.68 → 0.2.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,6 +101,7 @@ export interface ICase {
101
101
  caseRecipientFacility: Facility;
102
102
  caseRecoveryLocation: Facility;
103
103
  casePickupLocation?: Facility;
104
+ equipmentReturnRequested?: boolean;
104
105
  createdAt?: number;
105
106
  updatedAt?: number;
106
107
  }
@@ -115,6 +116,7 @@ export declare class Case implements ICase {
115
116
  caseRecipientFacility: Facility;
116
117
  caseRecoveryLocation: Facility;
117
118
  casePickupLocation?: Facility;
119
+ equipmentReturnRequested?: boolean;
118
120
  createdAt?: number;
119
121
  updatedAt?: number;
120
122
  constructor(caseData: ICase);
@@ -60,6 +60,7 @@ class Case {
60
60
  this.caseRecipientFacility = caseData.caseRecipientFacility;
61
61
  this.caseRecoveryLocation = caseData.caseRecoveryLocation;
62
62
  this.casePickupLocation = caseData.casePickupLocation;
63
+ this.equipmentReturnRequested = caseData.equipmentReturnRequested || false;
63
64
  this.createdAt = caseData.createdAt;
64
65
  this.updatedAt = caseData.updatedAt;
65
66
  }
@@ -159,6 +159,7 @@ export interface ITransportationRequest {
159
159
  cancellationReason?: string;
160
160
  eventLog?: IEventLog[];
161
161
  isTrainingMode?: boolean;
162
+ equipmentReturnRequested?: boolean;
162
163
  createdAt?: number;
163
164
  updatedAt?: number;
164
165
  }
@@ -184,6 +185,7 @@ export declare class TransportationRequest implements ITransportationRequest {
184
185
  cancellationReason?: string | undefined;
185
186
  eventLog?: IEventLog[] | undefined;
186
187
  isTrainingMode?: boolean;
188
+ equipmentReturnRequested?: boolean;
187
189
  createdAt?: number;
188
190
  updatedAt?: number;
189
191
  constructor(transportationRequest: ITransportationRequest);
@@ -197,6 +197,8 @@ class TransportationRequest {
197
197
  this.cancellationReason = transportationRequest.cancellationReason;
198
198
  this.eventLog = transportationRequest.eventLog;
199
199
  this.isTrainingMode = transportationRequest.isTrainingMode || false;
200
+ this.equipmentReturnRequested =
201
+ transportationRequest.equipmentReturnRequested || false;
200
202
  this.createdAt = transportationRequest.createdAt;
201
203
  this.updatedAt = transportationRequest.updatedAt;
202
204
  }
@@ -208,7 +210,7 @@ class TransportationRequest {
208
210
  return false;
209
211
  }
210
212
  createTripAirSegmentsFromTransportationRequest(localTimezone, distalTimezone) {
211
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
212
214
  const recoveryTimeDuration = this.transportationRequestType === TransportRequestType.ONE_WAY
213
215
  ? luxon_1.Duration.fromObject({ minutes: 0 })
214
216
  : (_a = exports.RECOVERY_TIME_DURATION[this.recoveryType]) !== null && _a !== void 0 ? _a : luxon_1.Duration.fromObject({ hours: 3, minutes: 0 });
@@ -233,13 +235,24 @@ class TransportationRequest {
233
235
  // Air Arrival Time =
234
236
  // Air Departure Time + flight time
235
237
  //
238
+ // If equipment return is requested, add recovery time between legs
239
+ // Air Departure Time =
240
+ // OR Time
241
+ // + 30 minutes of getting from hospital and into car
242
+ // + 30 minutes of drive time to the hospital
243
+ // + 30 minutes of getting from car to flight and ready for departure
244
+ // + flight time
245
+ // + 90 minutes for awaiting equipment return from hospital
246
+ // Air Arrival Time =
247
+ // Air Departure Time + flight time
248
+ //
236
249
  return [
237
250
  {
238
251
  transportationOperatorId: this.organizationId,
239
252
  segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
240
253
  segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
241
254
  passengers: [],
242
- segmentNumber: 0,
255
+ segmentNumber: 1,
243
256
  scheduledArrivalAirportCode: `${((_b = this.recoveryLocation) === null || _b === void 0 ? void 0 : _b.preferredNearbyAirportCode) ||
244
257
  ((_c = this.recoveryLocation) === null || _c === void 0 ? void 0 : _c.city) + " area airport"}`,
245
258
  scheduledArrivalAirportLocation: ((_d = this.recoveryLocation) === null || _d === void 0 ? void 0 : _d.location) || {
@@ -269,7 +282,7 @@ class TransportationRequest {
269
282
  passengers: [],
270
283
  segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
271
284
  segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
272
- segmentNumber: 0,
285
+ segmentNumber: 2,
273
286
  scheduledDepartureAirportCode: `${((_k = this.recoveryLocation) === null || _k === void 0 ? void 0 : _k.preferredNearbyAirportCode) ||
274
287
  ((_l = this.recoveryLocation) === null || _l === void 0 ? void 0 : _l.city) + " area airport"}`,
275
288
  scheduledDepartureFBO: (_m = this.recoveryLocation) === null || _m === void 0 ? void 0 : _m.preferredNearbyFBO,
@@ -296,6 +309,42 @@ class TransportationRequest {
296
309
  .toMillis(),
297
310
  scheduledArrivalTimeTimezone: localTimezone,
298
311
  },
312
+ this.equipmentReturnRequested && {
313
+ transportationOperatorId: this.organizationId,
314
+ passengers: [],
315
+ segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
316
+ segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
317
+ segmentNumber: 3,
318
+ scheduledDepartureAirportCode: `${((_t = this.recipientFacility) === null || _t === void 0 ? void 0 : _t.preferredNearbyAirportCode) ||
319
+ ((_u = this.recipientFacility) === null || _u === void 0 ? void 0 : _u.city) + " area airport"}`,
320
+ scheduledDepartureFBO: (_v = this.recipientFacility) === null || _v === void 0 ? void 0 : _v.preferredNearbyFBO,
321
+ scheduledDepartureAirportLocation: ((_w = this.recipientFacility) === null || _w === void 0 ? void 0 : _w.location) || {
322
+ lat: 0,
323
+ lng: 0,
324
+ },
325
+ scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
326
+ .plus(recoveryTimeDuration)
327
+ .plus({ hours: 1, minutes: 30 })
328
+ .plus(flightTime)
329
+ .plus({ hours: 1, minutes: 30 })
330
+ .toMillis(),
331
+ scheduledArrivalAirportCode: `${((_x = this.recoveryLocation) === null || _x === void 0 ? void 0 : _x.preferredNearbyAirportCode) ||
332
+ ((_y = this.recoveryLocation) === null || _y === void 0 ? void 0 : _y.city) + " area airport"}`,
333
+ scheduledArrivalFBO: (_z = this.recoveryLocation) === null || _z === void 0 ? void 0 : _z.preferredNearbyFBO,
334
+ scheduledArrivalAirportLocation: ((_0 = this.recoveryLocation) === null || _0 === void 0 ? void 0 : _0.location) || {
335
+ lat: 0,
336
+ lng: 0,
337
+ },
338
+ scheduledDepartureTimeTimezone: distalTimezone,
339
+ scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
340
+ .plus(recoveryTimeDuration)
341
+ .plus({ hours: 1, minutes: 30 })
342
+ .plus(flightTime)
343
+ .plus({ hours: 1, minutes: 30 })
344
+ .plus(flightTime)
345
+ .toMillis(),
346
+ scheduledArrivalTimeTimezone: localTimezone,
347
+ },
299
348
  ];
300
349
  }
301
350
  else {
@@ -305,26 +354,26 @@ class TransportationRequest {
305
354
  passengers: [],
306
355
  segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
307
356
  segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
308
- segmentNumber: 0,
309
- scheduledDepartureAirportCode: `${!((_t = this.pickupLocation) === null || _t === void 0 ? void 0 : _t.location) &&
310
- ((_u = this.recipientFacility) === null || _u === void 0 ? void 0 : _u.preferredNearbyAirportCode)
311
- ? (_v = this.recipientFacility) === null || _v === void 0 ? void 0 : _v.preferredNearbyAirportCode
312
- : ((_w = this.pickupLocation) === null || _w === void 0 ? void 0 : _w.city) + " area airport" ||
313
- ((_x = this.recoveryLocation) === null || _x === void 0 ? void 0 : _x.city) + " area airport"}`,
314
- scheduledDepartureFBO: !((_y = this.pickupLocation) === null || _y === void 0 ? void 0 : _y.location)
315
- ? (_z = this.recipientFacility) === null || _z === void 0 ? void 0 : _z.preferredNearbyFBO
357
+ segmentNumber: 2,
358
+ scheduledDepartureAirportCode: `${!((_1 = this.pickupLocation) === null || _1 === void 0 ? void 0 : _1.location) &&
359
+ ((_2 = this.recipientFacility) === null || _2 === void 0 ? void 0 : _2.preferredNearbyAirportCode)
360
+ ? (_3 = this.recipientFacility) === null || _3 === void 0 ? void 0 : _3.preferredNearbyAirportCode
361
+ : ((_4 = this.pickupLocation) === null || _4 === void 0 ? void 0 : _4.city) + " area airport" ||
362
+ ((_5 = this.recoveryLocation) === null || _5 === void 0 ? void 0 : _5.city) + " area airport"}`,
363
+ scheduledDepartureFBO: !((_6 = this.pickupLocation) === null || _6 === void 0 ? void 0 : _6.location)
364
+ ? (_7 = this.recipientFacility) === null || _7 === void 0 ? void 0 : _7.preferredNearbyFBO
316
365
  : undefined,
317
- scheduledDepartureAirportLocation: ((_0 = this.pickupLocation) === null || _0 === void 0 ? void 0 : _0.location) ||
318
- ((_1 = this.recoveryLocation) === null || _1 === void 0 ? void 0 : _1.location) || {
366
+ scheduledDepartureAirportLocation: ((_8 = this.pickupLocation) === null || _8 === void 0 ? void 0 : _8.location) ||
367
+ ((_9 = this.recoveryLocation) === null || _9 === void 0 ? void 0 : _9.location) || {
319
368
  lat: 0,
320
369
  lng: 0,
321
370
  },
322
371
  scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
323
372
  .plus({ hours: 1, minutes: 0 })
324
373
  .toMillis(),
325
- scheduledArrivalAirportCode: `${((_2 = this.recipientFacility) === null || _2 === void 0 ? void 0 : _2.preferredNearbyAirportCode) ||
326
- ((_3 = this.recipientFacility) === null || _3 === void 0 ? void 0 : _3.city) + " area airport"}`,
327
- scheduledArrivalFBO: (_4 = this.recipientFacility) === null || _4 === void 0 ? void 0 : _4.preferredNearbyFBO,
374
+ scheduledArrivalAirportCode: `${((_10 = this.recipientFacility) === null || _10 === void 0 ? void 0 : _10.preferredNearbyAirportCode) ||
375
+ ((_11 = this.recipientFacility) === null || _11 === void 0 ? void 0 : _11.city) + " area airport"}`,
376
+ scheduledArrivalFBO: (_12 = this.recipientFacility) === null || _12 === void 0 ? void 0 : _12.preferredNearbyFBO,
328
377
  scheduledArrivalAirportLocation: this.recipientFacility.location || {
329
378
  lat: 0,
330
379
  lng: 0,
@@ -336,6 +385,41 @@ class TransportationRequest {
336
385
  .toMillis(),
337
386
  scheduledArrivalTimeTimezone: localTimezone,
338
387
  },
388
+ this.equipmentReturnRequested && {
389
+ transportationOperatorId: this.organizationId,
390
+ passengers: [],
391
+ segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
392
+ segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
393
+ segmentNumber: 2,
394
+ scheduledDepartureAirportCode: `${((_13 = this.recipientFacility) === null || _13 === void 0 ? void 0 : _13.preferredNearbyAirportCode)
395
+ ? (_14 = this.recipientFacility) === null || _14 === void 0 ? void 0 : _14.preferredNearbyAirportCode
396
+ : ((_15 = this.recipientFacility) === null || _15 === void 0 ? void 0 : _15.city) + " area airport"}`,
397
+ scheduledDepartureFBO: (_16 = this.recipientFacility) === null || _16 === void 0 ? void 0 : _16.preferredNearbyFBO,
398
+ scheduledDepartureAirportLocation: ((_17 = this.recipientFacility) === null || _17 === void 0 ? void 0 : _17.location) || {
399
+ lat: 0,
400
+ lng: 0,
401
+ },
402
+ scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
403
+ .plus({ hours: 1, minutes: 0 })
404
+ .plus(flightTime)
405
+ .plus({ hours: 1, minutes: 30 })
406
+ .toMillis(),
407
+ scheduledArrivalAirportCode: `${((_18 = this.recoveryLocation) === null || _18 === void 0 ? void 0 : _18.preferredNearbyAirportCode) ||
408
+ ((_19 = this.recoveryLocation) === null || _19 === void 0 ? void 0 : _19.city) + " area airport"}`,
409
+ scheduledArrivalFBO: (_20 = this.recoveryLocation) === null || _20 === void 0 ? void 0 : _20.preferredNearbyFBO,
410
+ scheduledArrivalAirportLocation: this.recoveryLocation.location || {
411
+ lat: 0,
412
+ lng: 0,
413
+ },
414
+ scheduledDepartureTimeTimezone: distalTimezone,
415
+ scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
416
+ .plus({ hours: 1, minutes: 0 })
417
+ .plus(flightTime)
418
+ .plus({ hours: 1, minutes: 30 })
419
+ .plus(flightTime)
420
+ .toMillis(),
421
+ scheduledArrivalTimeTimezone: localTimezone,
422
+ },
339
423
  ];
340
424
  }
341
425
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulsecharterconnect/types",
3
- "version": "0.2.68",
3
+ "version": "0.2.70",
4
4
  "description": "A TypeScript library for enhanced type safety.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",