@kohost/api-client 3.0.0-beta.45 → 3.0.0-beta.47

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.
@@ -248,50 +248,126 @@ var require_schema = __commonJS({
248
248
  }
249
249
  });
250
250
 
251
- // src/schemas/switch.json
252
- var require_switch = __commonJS({
253
- "src/schemas/switch.json"(exports2, module2) {
251
+ // src/schemas/reservation.json
252
+ var require_reservation = __commonJS({
253
+ "src/schemas/reservation.json"(exports2, module2) {
254
254
  module2.exports = {
255
255
  $schema: "http://json-schema.org/draft-07/schema",
256
- $id: "https://api.kohost.io/schemas/v3/switch.json",
257
- title: "Switch",
258
- description: "Any smart switch",
256
+ $id: "https://api.kohost.io/schemas/v3/reservation.json",
257
+ title: "Reservation",
259
258
  type: "object",
259
+ required: ["type", "status", "checkInDateTime", "checkOutDateTime"],
260
260
  properties: {
261
261
  id: {
262
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
262
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
263
263
  },
264
- name: {
264
+ driver: {
265
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
266
+ },
267
+ primaryGuest: {
265
268
  type: "string"
266
269
  },
267
270
  type: {
268
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
271
+ type: "string"
269
272
  },
270
- subType: {
271
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
273
+ sharedGuests: {
274
+ type: "array",
275
+ items: {
276
+ type: "string"
277
+ }
272
278
  },
273
- supportedNotifications: {
274
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
279
+ spaceType: {
280
+ type: "string"
275
281
  },
276
- notification: {
277
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
282
+ space: {
283
+ type: "string"
278
284
  },
279
- driver: {
280
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
285
+ status: {
286
+ type: "string",
287
+ enum: [
288
+ "reserved",
289
+ "checkedIn",
290
+ "checkedOut",
291
+ "cancelled",
292
+ "noShow",
293
+ "enquired",
294
+ "requested",
295
+ "optional"
296
+ ],
297
+ description: " reserved - confirmed by both parties, before check-in\n checkedIn - checked in\n checkedOut - checked out\n cancelled - Cancelled\n noShow - No show\n enquired - Confirmed neither by the customer nor enterprise\n requested - Confirmed by the customer but not the enterprise (waitlist)\n optional - Confirmed by the enterprise but not the customer (holding)"
281
298
  },
282
- state: {
299
+ mobileCheckInStatus: {
283
300
  type: "string",
284
- enum: ["on", "off"]
301
+ enum: [
302
+ "ready",
303
+ "blocked",
304
+ "preArrivalStepsRequired",
305
+ "spaceNotAssigned",
306
+ "spaceNotReady",
307
+ "checkInTimeNotStarted"
308
+ ]
309
+ },
310
+ mobileCheckInStatusMessage: {
311
+ type: "string"
312
+ },
313
+ confirmationNumber: {
314
+ type: "string"
315
+ },
316
+ checkInDateTime: {
317
+ type: ["string", "object"],
318
+ format: "date-time"
319
+ },
320
+ checkOutDateTime: {
321
+ type: ["string", "object"],
322
+ format: "date-time"
323
+ },
324
+ adultCount: {
325
+ type: "number",
326
+ default: 1,
327
+ minimum: 1
328
+ },
329
+ childCount: {
330
+ type: "number",
331
+ default: 0
332
+ },
333
+ revenue: {
334
+ type: "array",
335
+ items: {
336
+ type: "object",
337
+ properties: {
338
+ date: {
339
+ type: "string",
340
+ format: "date-time"
341
+ },
342
+ amount: {
343
+ type: "number"
344
+ },
345
+ type: {
346
+ type: "string",
347
+ enum: ["service", "product"]
348
+ }
349
+ }
350
+ }
351
+ },
352
+ rateSuppressed: {
353
+ type: "boolean"
354
+ },
355
+ payment: {
356
+ type: "string"
357
+ },
358
+ company: {
359
+ type: "string"
360
+ },
361
+ travelAgent: {
362
+ type: "string"
285
363
  },
286
364
  systemData: {
287
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
365
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
288
366
  },
289
- watts: {
290
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
367
+ metadata: {
368
+ ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/metadata"
291
369
  }
292
- },
293
- additionalProperties: false,
294
- required: ["id", "type", "systemData", "state", "driver"]
370
+ }
295
371
  };
296
372
  }
297
373
  });
@@ -299,14 +375,17 @@ var require_switch = __commonJS({
299
375
  // src/Errors/AppError.js
300
376
  var require_AppError = __commonJS({
301
377
  "src/Errors/AppError.js"(exports2, module2) {
302
- module2.exports = /* @__PURE__ */ __name(class AppError extends Error {
378
+ module2.exports = class AppError extends Error {
379
+ static {
380
+ __name(this, "AppError");
381
+ }
303
382
  constructor(message = "Internal Server Error", options) {
304
383
  super(message, options);
305
384
  this.type = this.constructor.name;
306
385
  this.statusCode = 500;
307
386
  Object.setPrototypeOf(this, AppError.prototype);
308
387
  }
309
- }, "AppError");
388
+ };
310
389
  }
311
390
  });
312
391
 
@@ -314,13 +393,16 @@ var require_AppError = __commonJS({
314
393
  var require_AuthenticationError = __commonJS({
315
394
  "src/Errors/AuthenticationError.js"(exports2, module2) {
316
395
  var AppError = require_AppError();
317
- module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
396
+ module2.exports = class AuthenticationError extends AppError {
397
+ static {
398
+ __name(this, "AuthenticationError");
399
+ }
318
400
  constructor(message = "Authentication Error", options = {}) {
319
401
  super(message, options);
320
402
  this.statusCode = 401;
321
403
  Object.setPrototypeOf(this, AuthenticationError.prototype);
322
404
  }
323
- }, "AuthenticationError");
405
+ };
324
406
  }
325
407
  });
326
408
 
@@ -328,13 +410,16 @@ var require_AuthenticationError = __commonJS({
328
410
  var require_AuthorizationError = __commonJS({
329
411
  "src/Errors/AuthorizationError.js"(exports2, module2) {
330
412
  var AppError = require_AppError();
331
- module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
413
+ module2.exports = class AuthorizationError extends AppError {
414
+ static {
415
+ __name(this, "AuthorizationError");
416
+ }
332
417
  constructor(message = "Authorization Error", options = {}) {
333
418
  super(message, options);
334
419
  this.statusCode = 403;
335
420
  Object.setPrototypeOf(this, AuthorizationError.prototype);
336
421
  }
337
- }, "AuthorizationError");
422
+ };
338
423
  }
339
424
  });
340
425
 
@@ -342,13 +427,16 @@ var require_AuthorizationError = __commonJS({
342
427
  var require_DeviceCommError = __commonJS({
343
428
  "src/Errors/DeviceCommError.js"(exports2, module2) {
344
429
  var AppError = require_AppError();
345
- module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
430
+ module2.exports = class DeviceCommError extends AppError {
431
+ static {
432
+ __name(this, "DeviceCommError");
433
+ }
346
434
  constructor(message = "Device Communication Error", options = {}) {
347
435
  super(message, options);
348
436
  this.statusCode = 503;
349
437
  Object.setPrototypeOf(this, DeviceCommError.prototype);
350
438
  }
351
- }, "DeviceCommError");
439
+ };
352
440
  }
353
441
  });
354
442
 
@@ -356,13 +444,16 @@ var require_DeviceCommError = __commonJS({
356
444
  var require_LoginError = __commonJS({
357
445
  "src/Errors/LoginError.js"(exports2, module2) {
358
446
  var AppError = require_AppError();
359
- module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
447
+ module2.exports = class LoginError extends AppError {
448
+ static {
449
+ __name(this, "LoginError");
450
+ }
360
451
  constructor(message = "Invalid Login information provided", options = {}) {
361
452
  super(message, options);
362
453
  this.statusCode = 401;
363
454
  Object.setPrototypeOf(this, LoginError.prototype);
364
455
  }
365
- }, "LoginError");
456
+ };
366
457
  }
367
458
  });
368
459
 
@@ -370,13 +461,16 @@ var require_LoginError = __commonJS({
370
461
  var require_NotFoundError = __commonJS({
371
462
  "src/Errors/NotFoundError.js"(exports2, module2) {
372
463
  var AppError = require_AppError();
373
- module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
464
+ module2.exports = class NotFoundError extends AppError {
465
+ static {
466
+ __name(this, "NotFoundError");
467
+ }
374
468
  constructor(message = "Resource Not Found", options = {}) {
375
469
  super(message, options);
376
470
  this.statusCode = 404;
377
471
  Object.setPrototypeOf(this, NotFoundError.prototype);
378
472
  }
379
- }, "NotFoundError");
473
+ };
380
474
  }
381
475
  });
382
476
 
@@ -384,13 +478,16 @@ var require_NotFoundError = __commonJS({
384
478
  var require_RequestError = __commonJS({
385
479
  "src/Errors/RequestError.js"(exports2, module2) {
386
480
  var AppError = require_AppError();
387
- module2.exports = /* @__PURE__ */ __name(class RequestError extends AppError {
481
+ module2.exports = class RequestError extends AppError {
482
+ static {
483
+ __name(this, "RequestError");
484
+ }
388
485
  constructor(message = "Bad Request", options = {}) {
389
486
  super(message, options);
390
487
  this.statusCode = 400;
391
488
  Object.setPrototypeOf(this, RequestError.prototype);
392
489
  }
393
- }, "RequestError");
490
+ };
394
491
  }
395
492
  });
396
493
 
@@ -398,13 +495,16 @@ var require_RequestError = __commonJS({
398
495
  var require_SystemCommError = __commonJS({
399
496
  "src/Errors/SystemCommError.js"(exports2, module2) {
400
497
  var AppError = require_AppError();
401
- module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
498
+ module2.exports = class SystemCommError extends AppError {
499
+ static {
500
+ __name(this, "SystemCommError");
501
+ }
402
502
  constructor(message = "System Communication Error", options = {}) {
403
503
  super(message, options);
404
504
  this.statusCode = 503;
405
505
  Object.setPrototypeOf(this, SystemCommError.prototype);
406
506
  }
407
- }, "SystemCommError");
507
+ };
408
508
  }
409
509
  });
410
510
 
@@ -412,13 +512,16 @@ var require_SystemCommError = __commonJS({
412
512
  var require_TokenExpiredError = __commonJS({
413
513
  "src/Errors/TokenExpiredError.js"(exports2, module2) {
414
514
  var AppError = require_AppError();
415
- module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
515
+ module2.exports = class TokenExpiredError extends AppError {
516
+ static {
517
+ __name(this, "TokenExpiredError");
518
+ }
416
519
  constructor(message = "Token Expired", options = {}) {
417
520
  super(message, options);
418
521
  this.statusCode = 401;
419
522
  Object.setPrototypeOf(this, TokenExpiredError.prototype);
420
523
  }
421
- }, "TokenExpiredError");
524
+ };
422
525
  }
423
526
  });
424
527
 
@@ -426,13 +529,16 @@ var require_TokenExpiredError = __commonJS({
426
529
  var require_UnprocessableRequestError = __commonJS({
427
530
  "src/Errors/UnprocessableRequestError.js"(exports2, module2) {
428
531
  var AppError = require_AppError();
429
- module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
532
+ module2.exports = class UnprocessableRequestError extends AppError {
533
+ static {
534
+ __name(this, "UnprocessableRequestError");
535
+ }
430
536
  constructor(message = "Unprocessable Request Error", options = {}) {
431
537
  super(message, options);
432
538
  this.statusCode = 422;
433
539
  Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
434
540
  }
435
- }, "UnprocessableRequestError");
541
+ };
436
542
  }
437
543
  });
438
544
 
@@ -440,13 +546,16 @@ var require_UnprocessableRequestError = __commonJS({
440
546
  var require_ValidationError = __commonJS({
441
547
  "src/Errors/ValidationError.js"(exports2, module2) {
442
548
  var AppError = require_AppError();
443
- module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
549
+ module2.exports = class ValidationError extends AppError {
550
+ static {
551
+ __name(this, "ValidationError");
552
+ }
444
553
  constructor(message = "Validation Error", options = {}) {
445
554
  super(message, options);
446
555
  this.statusCode = 400;
447
556
  Object.setPrototypeOf(this, ValidationError.prototype);
448
557
  }
449
- }, "ValidationError");
558
+ };
450
559
  }
451
560
  });
452
561
 
@@ -476,6 +585,9 @@ var require_kohost = __commonJS({
476
585
  var { ValidationError } = require_Errors();
477
586
  var { customAlphabet: generate } = require("nanoid");
478
587
  var Kohost = class {
588
+ static {
589
+ __name(this, "Kohost");
590
+ }
479
591
  constructor(data) {
480
592
  if (!this.schema) {
481
593
  throw new Error("Schema is not defined");
@@ -550,73 +662,316 @@ var require_kohost = __commonJS({
550
662
  return obj;
551
663
  }
552
664
  };
553
- __name(Kohost, "Kohost");
554
665
  module2.exports = Kohost;
555
666
  }
556
667
  });
557
668
 
558
- // src/Models/switch.js
559
- var require_switch2 = __commonJS({
560
- "src/Models/switch.js"(exports2, module2) {
669
+ // src/Models/reservation.js
670
+ var require_reservation2 = __commonJS({
671
+ "src/Models/reservation.js"(exports2, module2) {
561
672
  var schemas = require_schema();
562
- var schema = require_switch();
673
+ var schema = require_reservation();
563
674
  var Kohost = require_kohost();
564
675
  schemas.add(schema);
565
676
  var validator = schemas.compile(schema);
566
- var Switch2 = class extends Kohost {
677
+ var Reservation2 = class extends Kohost {
678
+ static {
679
+ __name(this, "Reservation");
680
+ }
567
681
  constructor(data) {
568
682
  super(data);
569
683
  }
684
+ get peopleCount() {
685
+ return this.adultCount + this.childCount;
686
+ }
687
+ get hasPayment() {
688
+ return this.paymentId?.length > 0;
689
+ }
690
+ range(tz) {
691
+ const start = new Date(this.checkInDateTime);
692
+ const end = new Date(this.checkOutDateTime);
693
+ if (start.getDate() === end.getDate() && start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
694
+ return `${start.toLocaleString("default", {
695
+ month: "short",
696
+ timeZone: tz
697
+ })} ${start.toLocaleString("default", {
698
+ timeZone: tz,
699
+ day: "numeric"
700
+ })}`;
701
+ }
702
+ if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
703
+ return `${start.toLocaleString("default", {
704
+ month: "short",
705
+ timeZone: tz
706
+ })} ${start.toLocaleString("default", {
707
+ timeZone: tz,
708
+ day: "numeric"
709
+ })}-${end.toLocaleString("default", {
710
+ timeZone: tz,
711
+ day: "numeric"
712
+ })}`;
713
+ }
714
+ return `${start.toLocaleString("default", {
715
+ month: "short",
716
+ timeZone: tz
717
+ })} ${start.getDate()} - ${end.toLocaleString("default", {
718
+ month: "short",
719
+ timeZone: tz
720
+ })} ${end.getDate()}`;
721
+ }
722
+ checkInTime(tz) {
723
+ return new Date(this.checkInDateTime).toLocaleString("default", {
724
+ hour: "numeric",
725
+ minute: "numeric",
726
+ timeZone: tz
727
+ });
728
+ }
729
+ checkOutTime(tz) {
730
+ return new Date(this.checkOutDateTime).toLocaleString("default", {
731
+ hour: "numeric",
732
+ minute: "numeric",
733
+ timeZone: tz
734
+ });
735
+ }
570
736
  };
571
- __name(Switch2, "Switch");
572
- Object.defineProperty(Switch2.prototype, "schema", {
737
+ Object.defineProperty(Reservation2.prototype, "schema", {
573
738
  value: schema
574
739
  });
575
- Object.defineProperty(Switch2.prototype, "validator", {
740
+ Object.defineProperty(Reservation2.prototype, "validator", {
576
741
  get: function() {
577
742
  return validator;
578
743
  }
579
744
  });
580
- Object.defineProperty(Switch2, "validProperties", {
745
+ Object.defineProperty(Reservation2, "validProperties", {
581
746
  value: Object.keys(schema.properties)
582
747
  });
583
- Object.defineProperty(Switch2, "actionProperties", {
584
- value: ["state"]
585
- });
586
- module2.exports = Switch2;
748
+ module2.exports = Reservation2;
587
749
  }
588
750
  });
589
751
 
590
- // src/schemas/alarm.json
591
- var require_alarm = __commonJS({
592
- "src/schemas/alarm.json"(exports2, module2) {
752
+ // src/schemas/mediaFile.json
753
+ var require_mediaFile = __commonJS({
754
+ "src/schemas/mediaFile.json"(exports2, module2) {
593
755
  module2.exports = {
594
756
  $schema: "http://json-schema.org/draft-07/schema",
595
- $id: "https://api.kohost.io/schemas/v3/alarm.json",
596
- title: "Alarm",
597
- description: "Any smart alarm system",
757
+ $id: "https://api.kohost.io/schemas/v3/mediaFile.json",
758
+ title: "Media File",
759
+ description: "Any media file",
598
760
  type: "object",
599
761
  properties: {
600
762
  id: {
601
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
602
- },
603
- name: {
604
- type: "string"
763
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
605
764
  },
606
765
  type: {
607
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
608
- },
609
- systemData: {
610
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
611
- },
612
- supportedNotifications: {
613
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
614
- },
615
- notification: {
616
- $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
766
+ type: "string",
767
+ default: "mediaFile"
617
768
  },
618
- driver: {
619
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
769
+ fileHash: {
770
+ type: "string"
771
+ },
772
+ mimeType: {
773
+ type: "string",
774
+ enum: [
775
+ "image/*",
776
+ "image/jpeg",
777
+ "image/png",
778
+ "image/gif",
779
+ "image/webp",
780
+ "image/avif",
781
+ "image/svg+xml",
782
+ "application/pdf"
783
+ ]
784
+ },
785
+ data: {
786
+ type: "string"
787
+ },
788
+ url: {
789
+ type: "string",
790
+ format: "uri"
791
+ },
792
+ width: {
793
+ type: "integer",
794
+ minimum: 0
795
+ },
796
+ height: {
797
+ type: "integer",
798
+ minimum: 0
799
+ },
800
+ size: {
801
+ type: "integer",
802
+ minimum: 0,
803
+ description: "Size in bytes"
804
+ },
805
+ uploadUrl: {
806
+ type: "string",
807
+ format: "uri"
808
+ },
809
+ uploadUrlExpires: {
810
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
811
+ },
812
+ createdBy: {
813
+ type: "string"
814
+ },
815
+ systemData: {
816
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
817
+ }
818
+ },
819
+ additionalProperties: false,
820
+ required: ["id", "type"]
821
+ };
822
+ }
823
+ });
824
+
825
+ // src/Models/mediaFile.js
826
+ var require_mediaFile2 = __commonJS({
827
+ "src/Models/mediaFile.js"(exports2, module2) {
828
+ var schemas = require_schema();
829
+ var schema = require_mediaFile();
830
+ var Kohost = require_kohost();
831
+ var { RequestError } = require_Errors();
832
+ schemas.add(schema);
833
+ var validator = schemas.compile(schema);
834
+ var MediaFile2 = class extends Kohost {
835
+ static {
836
+ __name(this, "MediaFile");
837
+ }
838
+ constructor(data) {
839
+ super(data);
840
+ }
841
+ createImageVariant(params) {
842
+ if (this.mimeType != "image/*")
843
+ throw new RequestError("Only dynamic images can have variants");
844
+ const query = Object.keys(params).map((key) => `${key}=${params[key]}`).join(",");
845
+ return this.url.replace(/\/public$/, `/${query}`);
846
+ }
847
+ };
848
+ Object.defineProperty(MediaFile2.prototype, "schema", {
849
+ value: schema
850
+ });
851
+ Object.defineProperty(MediaFile2.prototype, "validator", {
852
+ get: function() {
853
+ return validator;
854
+ }
855
+ });
856
+ Object.defineProperty(MediaFile2, "validProperties", {
857
+ value: Object.keys(schema.properties)
858
+ });
859
+ module2.exports = MediaFile2;
860
+ }
861
+ });
862
+
863
+ // src/schemas/switch.json
864
+ var require_switch = __commonJS({
865
+ "src/schemas/switch.json"(exports2, module2) {
866
+ module2.exports = {
867
+ $schema: "http://json-schema.org/draft-07/schema",
868
+ $id: "https://api.kohost.io/schemas/v3/switch.json",
869
+ title: "Switch",
870
+ description: "Any smart switch",
871
+ type: "object",
872
+ properties: {
873
+ id: {
874
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
875
+ },
876
+ name: {
877
+ type: "string"
878
+ },
879
+ type: {
880
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
881
+ },
882
+ subType: {
883
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
884
+ },
885
+ supportedNotifications: {
886
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
887
+ },
888
+ notification: {
889
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
890
+ },
891
+ driver: {
892
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
893
+ },
894
+ state: {
895
+ type: "string",
896
+ enum: ["on", "off"]
897
+ },
898
+ systemData: {
899
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
900
+ },
901
+ watts: {
902
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
903
+ }
904
+ },
905
+ additionalProperties: false,
906
+ required: ["id", "type", "systemData", "state", "driver"]
907
+ };
908
+ }
909
+ });
910
+
911
+ // src/Models/switch.js
912
+ var require_switch2 = __commonJS({
913
+ "src/Models/switch.js"(exports2, module2) {
914
+ var schemas = require_schema();
915
+ var schema = require_switch();
916
+ var Kohost = require_kohost();
917
+ schemas.add(schema);
918
+ var validator = schemas.compile(schema);
919
+ var Switch2 = class extends Kohost {
920
+ static {
921
+ __name(this, "Switch");
922
+ }
923
+ constructor(data) {
924
+ super(data);
925
+ }
926
+ };
927
+ Object.defineProperty(Switch2.prototype, "schema", {
928
+ value: schema
929
+ });
930
+ Object.defineProperty(Switch2.prototype, "validator", {
931
+ get: function() {
932
+ return validator;
933
+ }
934
+ });
935
+ Object.defineProperty(Switch2, "validProperties", {
936
+ value: Object.keys(schema.properties)
937
+ });
938
+ Object.defineProperty(Switch2, "actionProperties", {
939
+ value: ["state"]
940
+ });
941
+ module2.exports = Switch2;
942
+ }
943
+ });
944
+
945
+ // src/schemas/alarm.json
946
+ var require_alarm = __commonJS({
947
+ "src/schemas/alarm.json"(exports2, module2) {
948
+ module2.exports = {
949
+ $schema: "http://json-schema.org/draft-07/schema",
950
+ $id: "https://api.kohost.io/schemas/v3/alarm.json",
951
+ title: "Alarm",
952
+ description: "Any smart alarm system",
953
+ type: "object",
954
+ properties: {
955
+ id: {
956
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
957
+ },
958
+ name: {
959
+ type: "string"
960
+ },
961
+ type: {
962
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
963
+ },
964
+ systemData: {
965
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
966
+ },
967
+ supportedNotifications: {
968
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
969
+ },
970
+ notification: {
971
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
972
+ },
973
+ driver: {
974
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
620
975
  },
621
976
  areas: {
622
977
  type: "array",
@@ -705,11 +1060,13 @@ var require_alarm2 = __commonJS({
705
1060
  schemas.add(schema);
706
1061
  var validator = schemas.compile(schema);
707
1062
  var Alarm2 = class extends Kohost {
1063
+ static {
1064
+ __name(this, "Alarm");
1065
+ }
708
1066
  constructor(data) {
709
1067
  super(data);
710
1068
  }
711
1069
  };
712
- __name(Alarm2, "Alarm");
713
1070
  Object.defineProperty(Alarm2.prototype, "schema", {
714
1071
  value: schema
715
1072
  });
@@ -783,6 +1140,9 @@ var require_dimmer2 = __commonJS({
783
1140
  schemas.add(schema);
784
1141
  var validator = schemas.compile(schema);
785
1142
  var Dimmer2 = class extends Kohost {
1143
+ static {
1144
+ __name(this, "Dimmer");
1145
+ }
786
1146
  constructor(data) {
787
1147
  super(data);
788
1148
  }
@@ -802,7 +1162,6 @@ var require_dimmer2 = __commonJS({
802
1162
  return delta;
803
1163
  }
804
1164
  };
805
- __name(Dimmer2, "Dimmer");
806
1165
  Object.defineProperty(Dimmer2.prototype, "schema", {
807
1166
  value: schema
808
1167
  });
@@ -881,11 +1240,13 @@ var require_lock2 = __commonJS({
881
1240
  schemas.add(schema);
882
1241
  var validator = schemas.compile(schema);
883
1242
  var Lock2 = class extends Kohost {
1243
+ static {
1244
+ __name(this, "Lock");
1245
+ }
884
1246
  constructor(data) {
885
1247
  super(data);
886
1248
  }
887
1249
  };
888
- __name(Lock2, "Lock");
889
1250
  Object.defineProperty(Lock2.prototype, "schema", {
890
1251
  value: schema
891
1252
  });
@@ -1072,6 +1433,9 @@ var require_thermostat2 = __commonJS({
1072
1433
  schemas.add(schema);
1073
1434
  var validator = schemas.compile(schema);
1074
1435
  var Thermostat2 = class extends Kohost {
1436
+ static {
1437
+ __name(this, "Thermostat");
1438
+ }
1075
1439
  constructor(data) {
1076
1440
  super(data);
1077
1441
  }
@@ -1117,7 +1481,6 @@ var require_thermostat2 = __commonJS({
1117
1481
  return delta;
1118
1482
  }
1119
1483
  };
1120
- __name(Thermostat2, "Thermostat");
1121
1484
  Object.defineProperty(Thermostat2.prototype, "schema", {
1122
1485
  value: schema
1123
1486
  });
@@ -1194,6 +1557,9 @@ var require_windowCovering2 = __commonJS({
1194
1557
  schemas.add(schema);
1195
1558
  var validator = schemas.compile(schema);
1196
1559
  var WindowCovering2 = class extends Kohost {
1560
+ static {
1561
+ __name(this, "WindowCovering");
1562
+ }
1197
1563
  constructor(data) {
1198
1564
  super(data);
1199
1565
  }
@@ -1213,7 +1579,6 @@ var require_windowCovering2 = __commonJS({
1213
1579
  return delta;
1214
1580
  }
1215
1581
  };
1216
- __name(WindowCovering2, "WindowCovering");
1217
1582
  Object.defineProperty(WindowCovering2.prototype, "schema", {
1218
1583
  value: schema
1219
1584
  });
@@ -1240,7 +1605,15 @@ var require_identification = __commonJS({
1240
1605
  $id: "https://api.kohost.io/schemas/v3/identification.json",
1241
1606
  title: "Identification",
1242
1607
  type: "object",
1243
- required: ["type", "number"],
1608
+ required: ["type"],
1609
+ oneOf: [
1610
+ {
1611
+ required: ["number"]
1612
+ },
1613
+ {
1614
+ required: ["encryptedNumber"]
1615
+ }
1616
+ ],
1244
1617
  properties: {
1245
1618
  id: {
1246
1619
  $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
@@ -1252,6 +1625,12 @@ var require_identification = __commonJS({
1252
1625
  number: {
1253
1626
  string: "string"
1254
1627
  },
1628
+ maskedNumber: {
1629
+ string: "string"
1630
+ },
1631
+ encryptedNumber: {
1632
+ string: "string"
1633
+ },
1255
1634
  issued: {
1256
1635
  type: ["string", "object"],
1257
1636
  format: "date-time"
@@ -1294,6 +1673,9 @@ var require_identification2 = __commonJS({
1294
1673
  schemas.add(schema);
1295
1674
  var validator = schemas.compile(schema);
1296
1675
  var Identification2 = class extends Kohost {
1676
+ static {
1677
+ __name(this, "Identification");
1678
+ }
1297
1679
  constructor(data) {
1298
1680
  super(data);
1299
1681
  }
@@ -1301,7 +1683,6 @@ var require_identification2 = __commonJS({
1301
1683
  return new Date(this.expirationDate) < /* @__PURE__ */ new Date();
1302
1684
  }
1303
1685
  };
1304
- __name(Identification2, "Identification");
1305
1686
  Object.defineProperty(Identification2.prototype, "schema", {
1306
1687
  value: schema
1307
1688
  });
@@ -1361,7 +1742,7 @@ var require_user = __commonJS({
1361
1742
  type: "string"
1362
1743
  },
1363
1744
  photo: {
1364
- type: "string"
1745
+ $ref: "https://api.kohost.io/schemas/v3/mediaFile.json#"
1365
1746
  },
1366
1747
  jobTitle: {
1367
1748
  type: "string"
@@ -1415,7 +1796,7 @@ var require_user = __commonJS({
1415
1796
  files: {
1416
1797
  type: "array",
1417
1798
  items: {
1418
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
1799
+ $ref: "https://api.kohost.io/schemas/v3/mediaFile.json#"
1419
1800
  }
1420
1801
  },
1421
1802
  identifications: {
@@ -1449,6 +1830,15 @@ var require_user = __commonJS({
1449
1830
  }
1450
1831
  }
1451
1832
  },
1833
+ reservations: {
1834
+ type: "array",
1835
+ items: {
1836
+ $ref: "https://api.kohost.io/schemas/v3/reservation.json"
1837
+ }
1838
+ },
1839
+ spaceName: {
1840
+ type: "string"
1841
+ },
1452
1842
  createdAt: {
1453
1843
  $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
1454
1844
  },
@@ -1495,6 +1885,10 @@ var require_payment = __commonJS({
1495
1885
  "vpay"
1496
1886
  ]
1497
1887
  },
1888
+ enabled: {
1889
+ type: "boolean",
1890
+ default: true
1891
+ },
1498
1892
  storageData: {
1499
1893
  type: ["string", "null"]
1500
1894
  },
@@ -1522,12 +1916,21 @@ var require_user2 = __commonJS({
1522
1916
  var schema = require_user();
1523
1917
  var paymentSchema = require_payment();
1524
1918
  var Kohost = require_kohost();
1919
+ var MediaFile2 = require_mediaFile2();
1920
+ var Reservation2 = require_reservation2();
1525
1921
  var { nanoid } = require("nanoid/async");
1526
1922
  schemas.add(paymentSchema);
1527
1923
  schemas.add(schema);
1528
1924
  var validator = schemas.compile(schema);
1529
1925
  var User2 = class extends Kohost {
1926
+ static {
1927
+ __name(this, "User");
1928
+ }
1530
1929
  constructor(data) {
1930
+ if (data.photo)
1931
+ data.photo = new MediaFile2(data.photo);
1932
+ if (data.reservations)
1933
+ data.reservations = data.reservations.map((res) => new Reservation2(res));
1531
1934
  super(data);
1532
1935
  }
1533
1936
  static validatePhone(phoneNumber) {
@@ -1542,7 +1945,6 @@ var require_user2 = __commonJS({
1542
1945
  return await nanoid(len);
1543
1946
  }
1544
1947
  };
1545
- __name(User2, "User");
1546
1948
  Object.defineProperty(User2.prototype, "schema", {
1547
1949
  value: schema
1548
1950
  });
@@ -1646,7 +2048,7 @@ var require_systemUser = __commonJS({
1646
2048
  files: {
1647
2049
  type: "array",
1648
2050
  items: {
1649
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
2051
+ $ref: "https://api.kohost.io/schemas/v3/mediaFile.json#"
1650
2052
  }
1651
2053
  },
1652
2054
  identifications: {
@@ -1684,6 +2086,9 @@ var require_systemUser2 = __commonJS({
1684
2086
  schemas.add(schema);
1685
2087
  var validator = schemas.compile(schema);
1686
2088
  var SystemUser2 = class extends Kohost {
2089
+ static {
2090
+ __name(this, "SystemUser");
2091
+ }
1687
2092
  constructor(data) {
1688
2093
  super(data);
1689
2094
  }
@@ -1696,7 +2101,6 @@ var require_systemUser2 = __commonJS({
1696
2101
  return regex.test(email);
1697
2102
  }
1698
2103
  };
1699
- __name(SystemUser2, "SystemUser");
1700
2104
  Object.defineProperty(SystemUser2.prototype, "schema", {
1701
2105
  value: schema
1702
2106
  });
@@ -1778,11 +2182,13 @@ var require_courtesy2 = __commonJS({
1778
2182
  schemas.add(schema);
1779
2183
  var validator = schemas.compile(schema);
1780
2184
  var Courtesy2 = class extends Kohost {
2185
+ static {
2186
+ __name(this, "Courtesy");
2187
+ }
1781
2188
  constructor(data) {
1782
2189
  super(data);
1783
2190
  }
1784
2191
  };
1785
- __name(Courtesy2, "Courtesy");
1786
2192
  Object.defineProperty(Courtesy2.prototype, "schema", {
1787
2193
  value: schema
1788
2194
  });
@@ -1866,11 +2272,13 @@ var require_camera2 = __commonJS({
1866
2272
  schemas.add(schema);
1867
2273
  var validator = schemas.compile(schema);
1868
2274
  var Camera2 = class extends Kohost {
2275
+ static {
2276
+ __name(this, "Camera");
2277
+ }
1869
2278
  constructor(data) {
1870
2279
  super(data);
1871
2280
  }
1872
2281
  };
1873
- __name(Camera2, "Camera");
1874
2282
  Object.defineProperty(Camera2.prototype, "schema", {
1875
2283
  value: schema
1876
2284
  });
@@ -1933,11 +2341,13 @@ var require_motionSensor2 = __commonJS({
1933
2341
  schemas.add(schema);
1934
2342
  var validator = schemas.compile(schema);
1935
2343
  var MotionSensor2 = class extends Kohost {
2344
+ static {
2345
+ __name(this, "MotionSensor");
2346
+ }
1936
2347
  constructor(data) {
1937
2348
  super(data);
1938
2349
  }
1939
2350
  };
1940
- __name(MotionSensor2, "MotionSensor");
1941
2351
  Object.defineProperty(MotionSensor2.prototype, "schema", {
1942
2352
  value: schema
1943
2353
  });
@@ -2152,11 +2562,13 @@ var require_mediaSource2 = __commonJS({
2152
2562
  schemas.add(schema);
2153
2563
  var validator = schemas.compile(schema);
2154
2564
  var MediaSource2 = class extends Kohost {
2565
+ static {
2566
+ __name(this, "MediaSource");
2567
+ }
2155
2568
  constructor(data) {
2156
2569
  super(data);
2157
2570
  }
2158
2571
  };
2159
- __name(MediaSource2, "MediaSource");
2160
2572
  Object.defineProperty(MediaSource2.prototype, "schema", {
2161
2573
  value: schema
2162
2574
  });
@@ -2261,21 +2673,6 @@ var require_room = __commonJS({
2261
2673
  $ref: "https://api.kohost.io/schemas/v3/alarm.json"
2262
2674
  }
2263
2675
  },
2264
- scenes: {
2265
- type: "array",
2266
- default: [],
2267
- items: {
2268
- description: "A list of scene IDs for later population, or entire scene objects",
2269
- oneOf: [
2270
- {
2271
- $ref: "https://api.kohost.io/schemas/v3/scene.json"
2272
- },
2273
- {
2274
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2275
- }
2276
- ]
2277
- }
2278
- },
2279
2676
  occupiedAt: {
2280
2677
  $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
2281
2678
  },
@@ -2371,12 +2768,15 @@ var require_scene = __commonJS({
2371
2768
  },
2372
2769
  fanMode: {
2373
2770
  $ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/fanMode"
2771
+ },
2772
+ setpointDelta: {
2773
+ type: "number"
2374
2774
  }
2375
2775
  }
2376
2776
  },
2377
2777
  default: []
2378
2778
  },
2379
- media: {
2779
+ mediaSources: {
2380
2780
  type: "array",
2381
2781
  items: {
2382
2782
  type: "object",
@@ -2415,20 +2815,186 @@ var require_scene = __commonJS({
2415
2815
  }
2416
2816
  });
2417
2817
 
2418
- // src/Models/scene.js
2419
- var require_scene2 = __commonJS({
2420
- "src/Models/scene.js"(exports2, module2) {
2421
- var schemas = require_schema();
2422
- var schema = require_scene();
2423
- var Kohost = require_kohost();
2424
- schemas.add(schema);
2425
- var validator = schemas.compile(schema);
2426
- var Scene2 = class extends Kohost {
2818
+ // src/Commands/Command.js
2819
+ var require_Command = __commonJS({
2820
+ "src/Commands/Command.js"(exports2, module2) {
2821
+ var Command = class {
2822
+ static {
2823
+ __name(this, "Command");
2824
+ }
2427
2825
  constructor(data) {
2428
- super(data);
2826
+ this.data = {};
2827
+ if (!data)
2828
+ throw new Error("Command data is required");
2829
+ if (typeof data !== "object")
2830
+ throw new Error("Command data must be an object");
2831
+ for (const key in data) {
2832
+ this.data[key] = data[key];
2833
+ }
2429
2834
  }
2430
- };
2431
- __name(Scene2, "Scene");
2835
+ get name() {
2836
+ throw new Error("Command name is required");
2837
+ }
2838
+ get type() {
2839
+ return "Command";
2840
+ }
2841
+ get routingKey() {
2842
+ return "";
2843
+ }
2844
+ get exchange() {
2845
+ return "Commands";
2846
+ }
2847
+ build() {
2848
+ return { data: { ...this.data } };
2849
+ }
2850
+ };
2851
+ module2.exports = Command;
2852
+ }
2853
+ });
2854
+
2855
+ // src/Commands/SetSceneCommand.js
2856
+ var require_SetSceneCommand = __commonJS({
2857
+ "src/Commands/SetSceneCommand.js"(exports2, module2) {
2858
+ var Command = require_Command();
2859
+ var SetSceneCommand = class extends Command {
2860
+ static {
2861
+ __name(this, "SetSceneCommand");
2862
+ }
2863
+ constructor({ id, devices, ...rest }) {
2864
+ super({ id, devices, ...rest });
2865
+ }
2866
+ get name() {
2867
+ return "SetScene";
2868
+ }
2869
+ get routingKey() {
2870
+ return `scene.${this.data.id}.set`;
2871
+ }
2872
+ };
2873
+ module2.exports = SetSceneCommand;
2874
+ }
2875
+ });
2876
+
2877
+ // src/Models/scene.js
2878
+ var require_scene2 = __commonJS({
2879
+ "src/Models/scene.js"(exports2, module2) {
2880
+ var schemas = require_schema();
2881
+ var schema = require_scene();
2882
+ var Kohost = require_kohost();
2883
+ var SetSceneCommand = require_SetSceneCommand();
2884
+ schemas.add(schema);
2885
+ var validator = schemas.compile(schema);
2886
+ var Scene2 = class extends Kohost {
2887
+ static {
2888
+ __name(this, "Scene");
2889
+ }
2890
+ constructor(data) {
2891
+ super(data);
2892
+ }
2893
+ static createSceneCommandPayload(room, scene) {
2894
+ const commandsByDriver = [];
2895
+ const sceneDevices = scene?.devices || {};
2896
+ const sceneId = scene.id;
2897
+ for (const deviceType in sceneDevices) {
2898
+ const sceneData = sceneDevices[deviceType];
2899
+ const roomDevices = room[deviceType];
2900
+ for (const data of sceneData) {
2901
+ const { id, ...deviceProps } = data;
2902
+ if (id === "*") {
2903
+ for (const device of roomDevices) {
2904
+ const driver = device.driver;
2905
+ const deviceCmd = {
2906
+ id: device.systemData?.id
2907
+ };
2908
+ for (const prop in deviceProps) {
2909
+ if (prop === "setpointDelta") {
2910
+ const delta = deviceProps[prop];
2911
+ const currentMode = device.hvacMode;
2912
+ const setpoints = device.setpoints;
2913
+ const minAutoDelta = device.minAutoDelta;
2914
+ const currentSetpoint = setpoints[currentMode];
2915
+ if (currentMode === "heat") {
2916
+ const setpointValue = Math.min(
2917
+ currentSetpoint.min,
2918
+ currentSetpoint.value - delta
2919
+ );
2920
+ deviceCmd.setpoints = {
2921
+ heat: {
2922
+ value: setpointValue
2923
+ }
2924
+ };
2925
+ }
2926
+ if (currentMode === "cool") {
2927
+ const setpointValue = Math.max(
2928
+ currentSetpoint.max,
2929
+ currentSetpoint.value + delta
2930
+ );
2931
+ deviceCmd.setpoints = {
2932
+ cool: {
2933
+ value: setpointValue
2934
+ }
2935
+ };
2936
+ }
2937
+ if (currentMode === "auto") {
2938
+ if (!currentSetpoint && setpoints.cool && setpoints.heat) {
2939
+ const heatSetpoint = Math.min(
2940
+ setpoints.heat.min,
2941
+ setpoints.heat.value - delta
2942
+ );
2943
+ const coolSetpoint = Math.max(
2944
+ setpoints.cool.max,
2945
+ setpoints.cool.value + delta
2946
+ );
2947
+ if (Math.abs(heatSetpoint - coolSetpoint) < minAutoDelta) {
2948
+ continue;
2949
+ }
2950
+ deviceCmd.setpoints = {
2951
+ heat: {
2952
+ value: heatSetpoint
2953
+ },
2954
+ cool: {
2955
+ value: coolSetpoint
2956
+ }
2957
+ };
2958
+ }
2959
+ }
2960
+ if (currentMode === "off") {
2961
+ continue;
2962
+ }
2963
+ } else {
2964
+ deviceCmd[prop] = deviceProps[prop];
2965
+ }
2966
+ }
2967
+ if (Object.keys(deviceCmd).length === 1) {
2968
+ continue;
2969
+ }
2970
+ const driverIndex = commandsByDriver.findIndex(
2971
+ (c) => c.driver === driver
2972
+ );
2973
+ if (driverIndex >= 0) {
2974
+ commandsByDriver[driverIndex].command.devices.push(deviceCmd);
2975
+ } else {
2976
+ commandsByDriver.push({
2977
+ driver,
2978
+ command: {
2979
+ id: sceneId,
2980
+ devices: [deviceCmd]
2981
+ }
2982
+ });
2983
+ }
2984
+ }
2985
+ }
2986
+ }
2987
+ }
2988
+ const commands = commandsByDriver.map((c) => {
2989
+ const command = new SetSceneCommand(c.command);
2990
+ return {
2991
+ driver: c.driver,
2992
+ command
2993
+ };
2994
+ });
2995
+ return commands;
2996
+ }
2997
+ };
2432
2998
  Object.defineProperty(Scene2.prototype, "schema", {
2433
2999
  value: schema
2434
3000
  });
@@ -2466,6 +3032,9 @@ var require_room2 = __commonJS({
2466
3032
  schemas.add(schema);
2467
3033
  var validator = schemas.compile(schema);
2468
3034
  var Room2 = class extends Kohost {
3035
+ static {
3036
+ __name(this, "Room");
3037
+ }
2469
3038
  constructor(data) {
2470
3039
  const roomData = mapRoomData(data);
2471
3040
  super(roomData);
@@ -2527,329 +3096,123 @@ var require_room2 = __commonJS({
2527
3096
  get hasShade() {
2528
3097
  return this.hasWindowCovering;
2529
3098
  }
2530
- get hasThermostat() {
2531
- return this.thermostats?.length > 0;
2532
- }
2533
- get hasClimate() {
2534
- return this.hasThermostat;
2535
- }
2536
- get hasLock() {
2537
- return this.locks?.length > 0;
2538
- }
2539
- get hasCourtesy() {
2540
- return this.courtesy?.length > 0;
2541
- }
2542
- get hasCamera() {
2543
- return this.cameras?.length > 0;
2544
- }
2545
- get hasAlarm() {
2546
- return this.alarms?.length > 0;
2547
- }
2548
- get hasMedia() {
2549
- return this.mediaSources?.length > 0;
2550
- }
2551
- get hasLight() {
2552
- const hasSubTypeLight = this.switches?.some((sw) => {
2553
- return sw.subType === "light" || sw.subType === "fan";
2554
- });
2555
- return this.hasDimmer || hasSubTypeLight;
2556
- }
2557
- get occupied() {
2558
- const now = /* @__PURE__ */ new Date();
2559
- const lastOccupied = new Date(this.occupiedAt);
2560
- const diff = now - lastOccupied;
2561
- return diff < 60 * 60 * 1e3;
2562
- }
2563
- };
2564
- __name(Room2, "Room");
2565
- Object.defineProperty(Room2.prototype, "schema", {
2566
- value: schema
2567
- });
2568
- Object.defineProperty(Room2.prototype, "validator", {
2569
- get: function() {
2570
- return validator;
2571
- }
2572
- });
2573
- Object.defineProperty(Room2, "validProperties", {
2574
- value: Object.keys(schema.properties)
2575
- });
2576
- function mapRoomData(data) {
2577
- const roomData = cloneDeep(data);
2578
- roomData.dimmers?.map((dimmer) => {
2579
- if (dimmer instanceof Dimmer2)
2580
- return dimmer;
2581
- else
2582
- return new Dimmer2(dimmer);
2583
- });
2584
- roomData.switches?.map((switch_) => {
2585
- if (switch_ instanceof Switch2)
2586
- return switch_;
2587
- else
2588
- return new Switch2(switch_);
2589
- });
2590
- roomData.windowCoverings?.map((windowCovering) => {
2591
- if (windowCovering instanceof WindowCovering2)
2592
- return windowCovering;
2593
- else
2594
- return new WindowCovering2(windowCovering);
2595
- });
2596
- roomData.thermostats?.map((thermostat) => {
2597
- if (thermostat instanceof Thermostat2)
2598
- return thermostat;
2599
- else
2600
- return new Thermostat2(thermostat);
2601
- });
2602
- roomData.locks?.map((lock) => {
2603
- if (lock instanceof Lock2)
2604
- return lock;
2605
- else
2606
- return new Lock2(lock);
2607
- });
2608
- roomData.courtesy?.map((courtesy) => {
2609
- if (courtesy instanceof Courtesy2)
2610
- return courtesy;
2611
- else
2612
- return new Courtesy2(courtesy);
2613
- });
2614
- roomData.mediaSources?.map((source) => {
2615
- if (source instanceof MediaSource2)
2616
- return source;
2617
- else
2618
- return new MediaSource2(source);
2619
- });
2620
- roomData.cameras?.map((camera) => {
2621
- if (camera instanceof Camera2)
2622
- return camera;
2623
- else
2624
- return new Camera2(camera);
2625
- });
2626
- roomData.alarms?.map((alarm) => {
2627
- if (alarm instanceof Alarm2)
2628
- return alarm;
2629
- else
2630
- return new Alarm2(alarm);
2631
- });
2632
- roomData.motionSensors?.map((motionSensor) => {
2633
- if (motionSensor instanceof MotionSensor2)
2634
- return motionSensor;
2635
- else
2636
- return new MotionSensor2(motionSensor);
2637
- });
2638
- roomData.scenes?.map((scene) => {
2639
- if (scene instanceof Scene2)
2640
- return scene;
2641
- else
2642
- return new Scene2(scene);
2643
- });
2644
- return roomData;
2645
- }
2646
- __name(mapRoomData, "mapRoomData");
2647
- module2.exports = Room2;
2648
- }
2649
- });
2650
-
2651
- // src/schemas/reservation.json
2652
- var require_reservation = __commonJS({
2653
- "src/schemas/reservation.json"(exports2, module2) {
2654
- module2.exports = {
2655
- $schema: "http://json-schema.org/draft-07/schema",
2656
- $id: "https://api.kohost.io/schemas/v3/reservation.json",
2657
- title: "Reservation",
2658
- type: "object",
2659
- required: ["type", "status", "checkInDateTime", "checkOutDateTime"],
2660
- properties: {
2661
- id: {
2662
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2663
- },
2664
- driver: {
2665
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
2666
- },
2667
- primaryGuest: {
2668
- type: "string"
2669
- },
2670
- type: {
2671
- type: "string"
2672
- },
2673
- sharedGuests: {
2674
- type: "array",
2675
- items: {
2676
- type: "string"
2677
- }
2678
- },
2679
- spaceType: {
2680
- type: "string"
2681
- },
2682
- space: {
2683
- type: "string"
2684
- },
2685
- status: {
2686
- type: "string",
2687
- enum: [
2688
- "reserved",
2689
- "checkedIn",
2690
- "checkedOut",
2691
- "cancelled",
2692
- "noShow",
2693
- "enquired",
2694
- "requested",
2695
- "optional"
2696
- ],
2697
- description: " reserved - confirmed by both parties, before check-in\n checkedIn - checked in\n checkedOut - checked out\n cancelled - Cancelled\n noShow - No show\n enquired - Confirmed neither by the customer nor enterprise\n requested - Confirmed by the customer but not the enterprise (waitlist)\n optional - Confirmed by the enterprise but not the customer (holding)"
2698
- },
2699
- mobileCheckInStatus: {
2700
- type: "string",
2701
- enum: [
2702
- "ready",
2703
- "blocked",
2704
- "preArrivalStepsRequired",
2705
- "spaceNotAssigned",
2706
- "spaceNotReady",
2707
- "checkInTimeNotStarted"
2708
- ]
2709
- },
2710
- mobileCheckInStatusMessage: {
2711
- type: "string"
2712
- },
2713
- confirmationNumber: {
2714
- type: "string"
2715
- },
2716
- checkInDateTime: {
2717
- type: ["string", "object"],
2718
- format: "date-time"
2719
- },
2720
- checkOutDateTime: {
2721
- type: ["string", "object"],
2722
- format: "date-time"
2723
- },
2724
- adultCount: {
2725
- type: "number",
2726
- default: 1,
2727
- minimum: 1
2728
- },
2729
- childCount: {
2730
- type: "number",
2731
- default: 0
2732
- },
2733
- revenue: {
2734
- type: "array",
2735
- items: {
2736
- type: "object",
2737
- properties: {
2738
- date: {
2739
- type: "string",
2740
- format: "date-time"
2741
- },
2742
- amount: {
2743
- type: "number"
2744
- },
2745
- type: {
2746
- type: "string",
2747
- enum: ["service", "product"]
2748
- }
2749
- }
2750
- }
2751
- },
2752
- rateSuppressed: {
2753
- type: "boolean"
2754
- },
2755
- payment: {
2756
- type: "string"
2757
- },
2758
- company: {
2759
- type: "string"
2760
- },
2761
- travelAgent: {
2762
- type: "string"
2763
- },
2764
- systemData: {
2765
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
2766
- },
2767
- metadata: {
2768
- ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/metadata"
2769
- }
2770
- }
2771
- };
2772
- }
2773
- });
2774
-
2775
- // src/Models/reservation.js
2776
- var require_reservation2 = __commonJS({
2777
- "src/Models/reservation.js"(exports2, module2) {
2778
- var schemas = require_schema();
2779
- var schema = require_reservation();
2780
- var Kohost = require_kohost();
2781
- schemas.add(schema);
2782
- var validator = schemas.compile(schema);
2783
- var Reservation2 = class extends Kohost {
2784
- constructor(data) {
2785
- super(data);
2786
- }
2787
- get peopleCount() {
2788
- return this.adultCount + this.childCount;
2789
- }
2790
- get hasPayment() {
2791
- return this.paymentId?.length > 0;
2792
- }
2793
- range(tz) {
2794
- const start = new Date(this.checkInDateTime);
2795
- const end = new Date(this.checkOutDateTime);
2796
- if (start.getDate() === end.getDate() && start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
2797
- return `${start.toLocaleString("default", {
2798
- month: "short",
2799
- timeZone: tz
2800
- })} ${start.toLocaleString("default", {
2801
- timeZone: tz,
2802
- day: "numeric"
2803
- })}`;
2804
- }
2805
- if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
2806
- return `${start.toLocaleString("default", {
2807
- month: "short",
2808
- timeZone: tz
2809
- })} ${start.toLocaleString("default", {
2810
- timeZone: tz,
2811
- day: "numeric"
2812
- })}-${end.toLocaleString("default", {
2813
- timeZone: tz,
2814
- day: "numeric"
2815
- })}`;
2816
- }
2817
- return `${start.toLocaleString("default", {
2818
- month: "short",
2819
- timeZone: tz
2820
- })} ${start.getDate()} - ${end.toLocaleString("default", {
2821
- month: "short",
2822
- timeZone: tz
2823
- })} ${end.getDate()}`;
3099
+ get hasThermostat() {
3100
+ return this.thermostats?.length > 0;
2824
3101
  }
2825
- checkInTime(tz) {
2826
- return new Date(this.checkInDateTime).toLocaleString("default", {
2827
- hour: "numeric",
2828
- minute: "numeric",
2829
- timeZone: tz
2830
- });
3102
+ get hasClimate() {
3103
+ return this.hasThermostat;
2831
3104
  }
2832
- checkOutTime(tz) {
2833
- return new Date(this.checkOutDateTime).toLocaleString("default", {
2834
- hour: "numeric",
2835
- minute: "numeric",
2836
- timeZone: tz
3105
+ get hasLock() {
3106
+ return this.locks?.length > 0;
3107
+ }
3108
+ get hasCourtesy() {
3109
+ return this.courtesy?.length > 0;
3110
+ }
3111
+ get hasCamera() {
3112
+ return this.cameras?.length > 0;
3113
+ }
3114
+ get hasAlarm() {
3115
+ return this.alarms?.length > 0;
3116
+ }
3117
+ get hasMedia() {
3118
+ return this.mediaSources?.length > 0;
3119
+ }
3120
+ get hasLight() {
3121
+ const hasSubTypeLight = this.switches?.some((sw) => {
3122
+ return sw.subType === "light" || sw.subType === "fan";
2837
3123
  });
3124
+ return this.hasDimmer || hasSubTypeLight;
3125
+ }
3126
+ get occupied() {
3127
+ const now = /* @__PURE__ */ new Date();
3128
+ const lastOccupied = new Date(this.occupiedAt);
3129
+ const diff = now - lastOccupied;
3130
+ return diff < 60 * 60 * 1e3;
2838
3131
  }
2839
3132
  };
2840
- __name(Reservation2, "Reservation");
2841
- Object.defineProperty(Reservation2.prototype, "schema", {
3133
+ Object.defineProperty(Room2.prototype, "schema", {
2842
3134
  value: schema
2843
3135
  });
2844
- Object.defineProperty(Reservation2.prototype, "validator", {
3136
+ Object.defineProperty(Room2.prototype, "validator", {
2845
3137
  get: function() {
2846
3138
  return validator;
2847
3139
  }
2848
3140
  });
2849
- Object.defineProperty(Reservation2, "validProperties", {
3141
+ Object.defineProperty(Room2, "validProperties", {
2850
3142
  value: Object.keys(schema.properties)
2851
3143
  });
2852
- module2.exports = Reservation2;
3144
+ function mapRoomData(data) {
3145
+ const roomData = cloneDeep(data);
3146
+ roomData.dimmers?.map((dimmer) => {
3147
+ if (dimmer instanceof Dimmer2)
3148
+ return dimmer;
3149
+ else
3150
+ return new Dimmer2(dimmer);
3151
+ });
3152
+ roomData.switches?.map((switch_) => {
3153
+ if (switch_ instanceof Switch2)
3154
+ return switch_;
3155
+ else
3156
+ return new Switch2(switch_);
3157
+ });
3158
+ roomData.windowCoverings?.map((windowCovering) => {
3159
+ if (windowCovering instanceof WindowCovering2)
3160
+ return windowCovering;
3161
+ else
3162
+ return new WindowCovering2(windowCovering);
3163
+ });
3164
+ roomData.thermostats?.map((thermostat) => {
3165
+ if (thermostat instanceof Thermostat2)
3166
+ return thermostat;
3167
+ else
3168
+ return new Thermostat2(thermostat);
3169
+ });
3170
+ roomData.locks?.map((lock) => {
3171
+ if (lock instanceof Lock2)
3172
+ return lock;
3173
+ else
3174
+ return new Lock2(lock);
3175
+ });
3176
+ roomData.courtesy?.map((courtesy) => {
3177
+ if (courtesy instanceof Courtesy2)
3178
+ return courtesy;
3179
+ else
3180
+ return new Courtesy2(courtesy);
3181
+ });
3182
+ roomData.mediaSources?.map((source) => {
3183
+ if (source instanceof MediaSource2)
3184
+ return source;
3185
+ else
3186
+ return new MediaSource2(source);
3187
+ });
3188
+ roomData.cameras?.map((camera) => {
3189
+ if (camera instanceof Camera2)
3190
+ return camera;
3191
+ else
3192
+ return new Camera2(camera);
3193
+ });
3194
+ roomData.alarms?.map((alarm) => {
3195
+ if (alarm instanceof Alarm2)
3196
+ return alarm;
3197
+ else
3198
+ return new Alarm2(alarm);
3199
+ });
3200
+ roomData.motionSensors?.map((motionSensor) => {
3201
+ if (motionSensor instanceof MotionSensor2)
3202
+ return motionSensor;
3203
+ else
3204
+ return new MotionSensor2(motionSensor);
3205
+ });
3206
+ roomData.scenes?.map((scene) => {
3207
+ if (scene instanceof Scene2)
3208
+ return scene;
3209
+ else
3210
+ return new Scene2(scene);
3211
+ });
3212
+ return roomData;
3213
+ }
3214
+ __name(mapRoomData, "mapRoomData");
3215
+ module2.exports = Room2;
2853
3216
  }
2854
3217
  });
2855
3218
 
@@ -2898,6 +3261,9 @@ var require_space = __commonJS({
2898
3261
  type: "string"
2899
3262
  }
2900
3263
  },
3264
+ occupied: {
3265
+ type: "boolean"
3266
+ },
2901
3267
  eco: {
2902
3268
  type: "object",
2903
3269
  additionalProperties: false,
@@ -2987,6 +3353,9 @@ var require_space2 = __commonJS({
2987
3353
  schemas.add(schema);
2988
3354
  var validator = schemas.compile(schema);
2989
3355
  var Space2 = class extends Kohost {
3356
+ static {
3357
+ __name(this, "Space");
3358
+ }
2990
3359
  constructor(data) {
2991
3360
  const spaceData = mapSpaceData(data);
2992
3361
  super(spaceData);
@@ -3026,11 +3395,7 @@ var require_space2 = __commonJS({
3026
3395
  get hasMedia() {
3027
3396
  return this.rooms.some((room) => room.hasMedia);
3028
3397
  }
3029
- get occupied() {
3030
- return this.rooms.some((room) => room.occupied);
3031
- }
3032
3398
  };
3033
- __name(Space2, "Space");
3034
3399
  Object.defineProperty(Space2.prototype, "schema", {
3035
3400
  value: schema
3036
3401
  });
@@ -3085,9 +3450,8 @@ var require_spaceType = __commonJS({
3085
3450
  description: {
3086
3451
  type: "string"
3087
3452
  },
3088
- imageUrl: {
3089
- format: "uri",
3090
- pattern: "^https?://"
3453
+ image: {
3454
+ $ref: "https://api.kohost.io/schemas/v3/mediaFile.json"
3091
3455
  },
3092
3456
  systemData: {
3093
3457
  $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
@@ -3106,11 +3470,13 @@ var require_spaceType2 = __commonJS({
3106
3470
  schemas.add(schema);
3107
3471
  var validator = schemas.compile(schema);
3108
3472
  var SpaceType2 = class extends Kohost {
3473
+ static {
3474
+ __name(this, "SpaceType");
3475
+ }
3109
3476
  constructor(data) {
3110
3477
  super(data);
3111
3478
  }
3112
3479
  };
3113
- __name(SpaceType2, "SpaceType");
3114
3480
  Object.defineProperty(SpaceType2.prototype, "schema", {
3115
3481
  value: schema
3116
3482
  });
@@ -3126,112 +3492,6 @@ var require_spaceType2 = __commonJS({
3126
3492
  }
3127
3493
  });
3128
3494
 
3129
- // src/schemas/mediaFile.json
3130
- var require_mediaFile = __commonJS({
3131
- "src/schemas/mediaFile.json"(exports2, module2) {
3132
- module2.exports = {
3133
- $schema: "http://json-schema.org/draft-07/schema",
3134
- $id: "https://api.kohost.io/schemas/v3/mediaFile.json",
3135
- title: "Media File",
3136
- description: "Any media file",
3137
- type: "object",
3138
- properties: {
3139
- id: {
3140
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3141
- },
3142
- type: {
3143
- type: "string",
3144
- default: "mediaFile"
3145
- },
3146
- fileHash: {
3147
- type: "string"
3148
- },
3149
- mimeType: {
3150
- type: "string",
3151
- enum: [
3152
- "image/*",
3153
- "image/jpeg",
3154
- "image/png",
3155
- "image/gif",
3156
- "image/webp",
3157
- "image/avif",
3158
- "image/svg+xml",
3159
- "application/pdf"
3160
- ]
3161
- },
3162
- url: {
3163
- type: "string",
3164
- format: "uri"
3165
- },
3166
- width: {
3167
- type: "integer",
3168
- minimum: 0
3169
- },
3170
- height: {
3171
- type: "integer",
3172
- minimum: 0
3173
- },
3174
- size: {
3175
- type: "integer",
3176
- minimum: 0,
3177
- description: "Size in bytes"
3178
- },
3179
- uploadUrl: {
3180
- type: "string",
3181
- format: "uri"
3182
- },
3183
- uploadUrlExpires: {
3184
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
3185
- },
3186
- createdBy: {
3187
- type: "string"
3188
- },
3189
- systemData: {
3190
- $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3191
- }
3192
- },
3193
- additionalProperties: false,
3194
- required: ["id", "type"]
3195
- };
3196
- }
3197
- });
3198
-
3199
- // src/Models/mediaFile.js
3200
- var require_mediaFile2 = __commonJS({
3201
- "src/Models/mediaFile.js"(exports2, module2) {
3202
- var schemas = require_schema();
3203
- var schema = require_mediaFile();
3204
- var Kohost = require_kohost();
3205
- var { RequestError } = require_Errors();
3206
- schemas.add(schema);
3207
- var validator = schemas.compile(schema);
3208
- var MediaFile2 = class extends Kohost {
3209
- constructor(data) {
3210
- super(data);
3211
- }
3212
- createImageVariant(params) {
3213
- if (this.mimeType != "image/*")
3214
- throw new RequestError("Only dynamic images can have variants");
3215
- const query = Object.keys(params).map((key) => `${key}=${params[key]}`).join(",");
3216
- return this.url.replace(/\/public$/, `/${query}`);
3217
- }
3218
- };
3219
- __name(MediaFile2, "MediaFile");
3220
- Object.defineProperty(MediaFile2.prototype, "schema", {
3221
- value: schema
3222
- });
3223
- Object.defineProperty(MediaFile2.prototype, "validator", {
3224
- get: function() {
3225
- return validator;
3226
- }
3227
- });
3228
- Object.defineProperty(MediaFile2, "validProperties", {
3229
- value: Object.keys(schema.properties)
3230
- });
3231
- module2.exports = MediaFile2;
3232
- }
3233
- });
3234
-
3235
3495
  // src/schemas/ticket.json
3236
3496
  var require_ticket = __commonJS({
3237
3497
  "src/schemas/ticket.json"(exports2, module2) {
@@ -3348,6 +3608,9 @@ var require_ticket2 = __commonJS({
3348
3608
  schemas.add(schema);
3349
3609
  var validator = schemas.compile(schema);
3350
3610
  var Ticket2 = class extends Kohost {
3611
+ static {
3612
+ __name(this, "Ticket");
3613
+ }
3351
3614
  constructor(data) {
3352
3615
  const ticketData = mapConversationData(data);
3353
3616
  super(ticketData);
@@ -3356,7 +3619,6 @@ var require_ticket2 = __commonJS({
3356
3619
  return nanoid(len);
3357
3620
  }
3358
3621
  };
3359
- __name(Ticket2, "Ticket");
3360
3622
  Object.defineProperty(Ticket2.prototype, "schema", {
3361
3623
  value: schema
3362
3624
  });
@@ -3478,11 +3740,13 @@ var require_gateway2 = __commonJS({
3478
3740
  schemas.add(schema);
3479
3741
  var validator = schemas.compile(schema);
3480
3742
  var Gateway2 = class extends Kohost {
3743
+ static {
3744
+ __name(this, "Gateway");
3745
+ }
3481
3746
  constructor(data) {
3482
3747
  super(data);
3483
3748
  }
3484
3749
  };
3485
- __name(Gateway2, "Gateway");
3486
3750
  Object.defineProperty(Gateway2.prototype, "schema", {
3487
3751
  value: schema
3488
3752
  });
@@ -3553,11 +3817,13 @@ var require_product2 = __commonJS({
3553
3817
  schemas.add(schema);
3554
3818
  var validator = schemas.compile(schema);
3555
3819
  var Product2 = class extends Kohost {
3820
+ static {
3821
+ __name(this, "Product");
3822
+ }
3556
3823
  constructor(data) {
3557
3824
  super(data);
3558
3825
  }
3559
3826
  };
3560
- __name(Product2, "Product");
3561
3827
  Object.defineProperty(Product2.prototype, "schema", {
3562
3828
  value: schema
3563
3829
  });
@@ -3619,11 +3885,13 @@ var require_discoveredDevice2 = __commonJS({
3619
3885
  schemas.add(schema);
3620
3886
  var validator = schemas.compile(schema);
3621
3887
  var DiscoveredDevice2 = class extends Kohost {
3888
+ static {
3889
+ __name(this, "DiscoveredDevice");
3890
+ }
3622
3891
  constructor(data) {
3623
3892
  super(data);
3624
3893
  }
3625
3894
  };
3626
- __name(DiscoveredDevice2, "DiscoveredDevice");
3627
3895
  Object.defineProperty(DiscoveredDevice2.prototype, "schema", {
3628
3896
  value: schema
3629
3897
  });
@@ -3685,11 +3953,13 @@ var require_credential2 = __commonJS({
3685
3953
  schemas.add(schema);
3686
3954
  var validator = schemas.compile(schema);
3687
3955
  var Credential2 = class extends Kohost {
3956
+ static {
3957
+ __name(this, "Credential");
3958
+ }
3688
3959
  constructor(data) {
3689
3960
  super(data);
3690
3961
  }
3691
3962
  };
3692
- __name(Credential2, "Credential");
3693
3963
  Object.defineProperty(Credential2.prototype, "schema", {
3694
3964
  value: schema
3695
3965
  });
@@ -3750,11 +4020,13 @@ var require_shortLink2 = __commonJS({
3750
4020
  schemas.add(schema);
3751
4021
  var validator = schemas.compile(schema);
3752
4022
  var ShortLink2 = class extends Kohost {
4023
+ static {
4024
+ __name(this, "ShortLink");
4025
+ }
3753
4026
  constructor(data) {
3754
4027
  super(data);
3755
4028
  }
3756
4029
  };
3757
- __name(ShortLink2, "ShortLink");
3758
4030
  Object.defineProperty(ShortLink2.prototype, "schema", {
3759
4031
  value: schema
3760
4032
  });
@@ -3860,11 +4132,13 @@ var require_energyReportShard2 = __commonJS({
3860
4132
  schemas.add(schema);
3861
4133
  var validator = schemas.compile(schema);
3862
4134
  var EnergyReportShard2 = class extends Kohost {
4135
+ static {
4136
+ __name(this, "EnergyReportShard");
4137
+ }
3863
4138
  constructor(data) {
3864
4139
  super(data);
3865
4140
  }
3866
4141
  };
3867
- __name(EnergyReportShard2, "EnergyReportShard");
3868
4142
  Object.defineProperty(EnergyReportShard2.prototype, "schema", {
3869
4143
  value: schema
3870
4144
  });
@@ -3981,11 +4255,13 @@ var require_energyReport2 = __commonJS({
3981
4255
  schemas.add(schema);
3982
4256
  var validator = schemas.compile(schema);
3983
4257
  var EnergyReport2 = class extends Kohost {
4258
+ static {
4259
+ __name(this, "EnergyReport");
4260
+ }
3984
4261
  constructor(data) {
3985
4262
  super(data);
3986
4263
  }
3987
4264
  };
3988
- __name(EnergyReport2, "EnergyReport");
3989
4265
  Object.defineProperty(EnergyReport2.prototype, "schema", {
3990
4266
  value: schema
3991
4267
  });
@@ -4077,11 +4353,13 @@ var require_smsMessage2 = __commonJS({
4077
4353
  schemas.add(schema);
4078
4354
  var validator = schemas.compile(schema);
4079
4355
  var SMSMessage2 = class extends Kohost {
4356
+ static {
4357
+ __name(this, "SMSMessage");
4358
+ }
4080
4359
  constructor(data) {
4081
4360
  super(data);
4082
4361
  }
4083
4362
  };
4084
- __name(SMSMessage2, "SMSMessage");
4085
4363
  Object.defineProperty(SMSMessage2.prototype, "schema", {
4086
4364
  value: schema
4087
4365
  });
@@ -4183,11 +4461,13 @@ var require_emailMessage2 = __commonJS({
4183
4461
  schemas.add(schema);
4184
4462
  var validator = schemas.compile(schema);
4185
4463
  var EmailMessage2 = class extends Kohost {
4464
+ static {
4465
+ __name(this, "EmailMessage");
4466
+ }
4186
4467
  constructor(data) {
4187
4468
  super(data);
4188
4469
  }
4189
4470
  };
4190
- __name(EmailMessage2, "EmailMessage");
4191
4471
  Object.defineProperty(EmailMessage2.prototype, "schema", {
4192
4472
  value: schema
4193
4473
  });
@@ -4377,10 +4657,18 @@ var require_property = __commonJS({
4377
4657
  payment: {},
4378
4658
  identification: {},
4379
4659
  earlyCheckIn: {
4660
+ type: "object",
4661
+ required: ["dynamic", "checkInTime", "checkOutTime"],
4380
4662
  properties: {
4381
4663
  dynamic: {
4382
4664
  type: "boolean",
4383
4665
  default: false
4666
+ },
4667
+ checkInTime: {
4668
+ type: "string"
4669
+ },
4670
+ checkOutTime: {
4671
+ type: "string"
4384
4672
  }
4385
4673
  }
4386
4674
  },
@@ -4396,6 +4684,10 @@ var require_property = __commonJS({
4396
4684
  type: "string",
4397
4685
  enum: ["salto"]
4398
4686
  },
4687
+ systemOnline: {
4688
+ type: "boolean",
4689
+ default: false
4690
+ },
4399
4691
  branding: {
4400
4692
  type: "object",
4401
4693
  properties: {
@@ -4451,11 +4743,13 @@ var require_property2 = __commonJS({
4451
4743
  schemas.add(schema);
4452
4744
  var validator = schemas.compile(schema);
4453
4745
  var Property2 = class extends Kohost {
4746
+ static {
4747
+ __name(this, "Property");
4748
+ }
4454
4749
  constructor(data) {
4455
4750
  super(data);
4456
4751
  }
4457
4752
  };
4458
- __name(Property2, "Property");
4459
4753
  Object.defineProperty(Property2.prototype, "schema", {
4460
4754
  value: schema
4461
4755
  });
@@ -4522,11 +4816,13 @@ var require_organization2 = __commonJS({
4522
4816
  schemas.add(schema);
4523
4817
  var validator = schemas.compile(schema);
4524
4818
  var Organization2 = class extends Kohost {
4819
+ static {
4820
+ __name(this, "Organization");
4821
+ }
4525
4822
  constructor(data) {
4526
4823
  super(data);
4527
4824
  }
4528
4825
  };
4529
- __name(Organization2, "Organization");
4530
4826
  Object.defineProperty(Organization2.prototype, "schema", {
4531
4827
  value: schema
4532
4828
  });
@@ -4543,6 +4839,8 @@ var require_organization2 = __commonJS({
4543
4839
  });
4544
4840
 
4545
4841
  // src/Models/index.js
4842
+ var Reservation = require_reservation2();
4843
+ var MediaFile = require_mediaFile2();
4546
4844
  var Switch = require_switch2();
4547
4845
  var Alarm = require_alarm2();
4548
4846
  var Dimmer = require_dimmer2();
@@ -4557,10 +4855,8 @@ var Camera = require_camera2();
4557
4855
  var MotionSensor = require_motionSensor2();
4558
4856
  var MediaSource = require_mediaSource2();
4559
4857
  var Room = require_room2();
4560
- var Reservation = require_reservation2();
4561
4858
  var Space = require_space2();
4562
4859
  var SpaceType = require_spaceType2();
4563
- var MediaFile = require_mediaFile2();
4564
4860
  var Ticket = require_ticket2();
4565
4861
  var Scene = require_scene2();
4566
4862
  var Gateway = require_gateway2();
@@ -4577,6 +4873,7 @@ var Organization = require_organization2();
4577
4873
  module.exports = {
4578
4874
  Organization,
4579
4875
  Property,
4876
+ MediaFile,
4580
4877
  Gateway,
4581
4878
  Switch,
4582
4879
  Alarm,
@@ -4604,6 +4901,5 @@ module.exports = {
4604
4901
  EnergyReportShard,
4605
4902
  EnergyReport,
4606
4903
  SMSMessage,
4607
- EmailMessage,
4608
- MediaFile
4904
+ EmailMessage
4609
4905
  };