@ricado/api-client 2.3.28 → 2.4.1

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.
Files changed (51) hide show
  1. package/dist/ricado.api.client.js +1 -1
  2. package/lib/Controllers/Lab/Site/DehydratorController.js +198 -0
  3. package/lib/Controllers/Lab/Site/FruitProfileController.js +204 -0
  4. package/lib/Controllers/Lab/Site/LabController.js +222 -0
  5. package/lib/Controllers/Lab/Site/RackController.js +222 -0
  6. package/lib/Controllers/Lab/Site/RackPositionController.js +207 -0
  7. package/lib/Controllers/Lab/Site/SampleController.js +1023 -0
  8. package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +192 -0
  9. package/lib/Controllers/Lab/Site/SampleResultController.js +905 -0
  10. package/lib/Controllers/Lab/Site/index.js +46 -0
  11. package/lib/Controllers/Lab/index.js +25 -0
  12. package/lib/Controllers/Packhouse/Site/ShiftController.js +304 -0
  13. package/lib/Controllers/index.js +9 -6
  14. package/lib/Models/Lab/Site/DehydratorModel.js +250 -0
  15. package/lib/Models/Lab/Site/FruitProfileModel.js +303 -0
  16. package/lib/Models/Lab/Site/LabModel.js +365 -0
  17. package/lib/Models/Lab/Site/RackModel.js +358 -0
  18. package/lib/Models/Lab/Site/RackPositionModel.js +525 -0
  19. package/lib/Models/Lab/Site/SampleFailureReasonModel.js +195 -0
  20. package/lib/Models/Lab/Site/SampleModel.js +545 -0
  21. package/lib/Models/Lab/Site/SampleResultModel.js +545 -0
  22. package/lib/Models/Lab/Site/index.js +46 -0
  23. package/lib/Models/Lab/index.js +25 -0
  24. package/lib/Models/index.js +7 -4
  25. package/lib/PackageVersion.js +1 -1
  26. package/lib/index.d.ts +10441 -7526
  27. package/package.json +1 -1
  28. package/src/Controllers/Lab/Site/DehydratorController.js +175 -0
  29. package/src/Controllers/Lab/Site/FruitProfileController.js +181 -0
  30. package/src/Controllers/Lab/Site/LabController.js +199 -0
  31. package/src/Controllers/Lab/Site/RackController.js +199 -0
  32. package/src/Controllers/Lab/Site/RackPositionController.js +184 -0
  33. package/src/Controllers/Lab/Site/SampleController.js +1160 -0
  34. package/src/Controllers/Lab/Site/SampleFailureReasonController.js +169 -0
  35. package/src/Controllers/Lab/Site/SampleResultController.js +1036 -0
  36. package/src/Controllers/Lab/Site/index.js +30 -0
  37. package/src/Controllers/Lab/index.js +16 -0
  38. package/src/Controllers/Packhouse/Site/ShiftController.js +367 -0
  39. package/src/Controllers/index.js +2 -0
  40. package/src/Models/Lab/Site/DehydratorModel.js +234 -0
  41. package/src/Models/Lab/Site/FruitProfileModel.js +290 -0
  42. package/src/Models/Lab/Site/LabModel.js +372 -0
  43. package/src/Models/Lab/Site/RackModel.js +358 -0
  44. package/src/Models/Lab/Site/RackPositionModel.js +600 -0
  45. package/src/Models/Lab/Site/SampleFailureReasonModel.js +170 -0
  46. package/src/Models/Lab/Site/SampleModel.js +565 -0
  47. package/src/Models/Lab/Site/SampleResultModel.js +565 -0
  48. package/src/Models/Lab/Site/index.js +30 -0
  49. package/src/Models/Lab/index.js +16 -0
  50. package/src/Models/index.js +2 -0
  51. package/src/PackageVersion.js +1 -1
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _DehydratorController = _interopRequireDefault(require("./DehydratorController"));
9
+
10
+ var _FruitProfileController = _interopRequireDefault(require("./FruitProfileController"));
11
+
12
+ var _LabController = _interopRequireDefault(require("./LabController"));
13
+
14
+ var _RackController = _interopRequireDefault(require("./RackController"));
15
+
16
+ var _RackPositionController = _interopRequireDefault(require("./RackPositionController"));
17
+
18
+ var _SampleController = _interopRequireDefault(require("./SampleController"));
19
+
20
+ var _SampleFailureReasonController = _interopRequireDefault(require("./SampleFailureReasonController"));
21
+
22
+ var _SampleResultController = _interopRequireDefault(require("./SampleResultController"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ /**
27
+ * File Auto-Generated by the RICADO Gen 4 PHP API Project
28
+ *
29
+ * Do Not Edit this File Manually!
30
+ */
31
+
32
+ /**
33
+ * @namespace Controllers.Lab.Site
34
+ */
35
+ var Site = {
36
+ DehydratorController: _DehydratorController.default,
37
+ FruitProfileController: _FruitProfileController.default,
38
+ LabController: _LabController.default,
39
+ RackController: _RackController.default,
40
+ RackPositionController: _RackPositionController.default,
41
+ SampleController: _SampleController.default,
42
+ SampleFailureReasonController: _SampleFailureReasonController.default,
43
+ SampleResultController: _SampleResultController.default
44
+ };
45
+ var _default = Site;
46
+ exports.default = _default;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _index = _interopRequireDefault(require("./Site/index"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /**
13
+ * File Auto-Generated by the RICADO Gen 4 PHP API Project
14
+ *
15
+ * Do Not Edit this File Manually!
16
+ */
17
+
18
+ /**
19
+ * @namespace Controllers.Lab
20
+ */
21
+ var Lab = {
22
+ Site: _index.default
23
+ };
24
+ var _default = Lab;
25
+ exports.default = _default;
@@ -776,6 +776,274 @@ var ShiftController = /*#__PURE__*/function () {
776
776
  });
777
777
  });
778
778
  }
779
+ /**
780
+ * Retrieve a Shift's Score History [GET /packhouse/sites/{siteId}/shifts/{id}/scoreHistory]
781
+ *
782
+ * Retrieves the Score History for a Shift
783
+ *
784
+ * @static
785
+ * @public
786
+ * @param {number} siteId The Site ID
787
+ * @param {string} id The Shift ID
788
+ * @return {Promise<Array<ShiftController.ScoreHistoryItem>>}
789
+ */
790
+
791
+ }, {
792
+ key: "getScoreHistory",
793
+ value: function getScoreHistory(siteId, id) {
794
+ return new Promise(function (resolve, reject) {
795
+ _RequestHelper.default.getRequest("/packhouse/sites/".concat(siteId, "/shifts/").concat(id, "/scoreHistory")).then(function (result) {
796
+ var resolveValue = function () {
797
+ if (Array.isArray(result) !== true) {
798
+ return [];
799
+ }
800
+
801
+ return result.map(function (resultItem) {
802
+ return function () {
803
+ var resultItemObject = {};
804
+
805
+ if (_typeof(resultItem) === 'object' && 'timestamp' in resultItem) {
806
+ resultItemObject.timestamp = function () {
807
+ if (typeof resultItem.timestamp !== 'string') {
808
+ return new Date(String(resultItem.timestamp));
809
+ }
810
+
811
+ return new Date(resultItem.timestamp);
812
+ }();
813
+ } else {
814
+ resultItemObject.timestamp = new Date();
815
+ }
816
+
817
+ if (_typeof(resultItem) === 'object' && 'score' in resultItem) {
818
+ resultItemObject.score = function () {
819
+ if (typeof resultItem.score !== 'number') {
820
+ return Number(resultItem.score);
821
+ }
822
+
823
+ return resultItem.score;
824
+ }();
825
+ } else {
826
+ resultItemObject.score = 0;
827
+ }
828
+
829
+ return resultItemObject;
830
+ }();
831
+ });
832
+ }();
833
+
834
+ resolve(resolveValue);
835
+ }).catch(function (error) {
836
+ return reject(error);
837
+ });
838
+ });
839
+ }
840
+ /**
841
+ * Retrieve a Shift Score Metrics [GET /packhouse/sites/{siteId}/shifts/{id}/scoreMetrics]
842
+ *
843
+ * Retrieves the Score Metrics for a Shift
844
+ *
845
+ * @static
846
+ * @public
847
+ * @param {number} siteId The Site ID
848
+ * @param {string} id The Shift ID
849
+ * @return {Promise<ShiftController.ShiftScoreMetrics>}
850
+ */
851
+
852
+ }, {
853
+ key: "getScoreMetrics",
854
+ value: function getScoreMetrics(siteId, id) {
855
+ return new Promise(function (resolve, reject) {
856
+ _RequestHelper.default.getRequest("/packhouse/sites/".concat(siteId, "/shifts/").concat(id, "/scoreMetrics")).then(function (result) {
857
+ var resolveValue = function () {
858
+ var resultObject = {};
859
+
860
+ if (_typeof(result) === 'object' && 'scoreActual' in result) {
861
+ resultObject.scoreActual = function () {
862
+ if (typeof result.scoreActual !== 'number') {
863
+ return Number(result.scoreActual);
864
+ }
865
+
866
+ return result.scoreActual;
867
+ }();
868
+ } else {
869
+ resultObject.scoreActual = 0;
870
+ }
871
+
872
+ if (_typeof(result) === 'object' && 'traysPerHourActual' in result) {
873
+ resultObject.traysPerHourActual = function () {
874
+ if (typeof result.traysPerHourActual !== 'number') {
875
+ return Number.isInteger(Number(result.traysPerHourActual)) ? Number(result.traysPerHourActual) : Math.floor(Number(result.traysPerHourActual));
876
+ }
877
+
878
+ return Number.isInteger(result.traysPerHourActual) ? result.traysPerHourActual : Math.floor(result.traysPerHourActual);
879
+ }();
880
+ } else {
881
+ resultObject.traysPerHourActual = 0;
882
+ }
883
+
884
+ if (_typeof(result) === 'object' && 'traysPerHourTarget' in result) {
885
+ resultObject.traysPerHourTarget = function () {
886
+ if (result.traysPerHourTarget === null) {
887
+ return null;
888
+ }
889
+
890
+ if (typeof result.traysPerHourTarget !== 'number') {
891
+ return Number.isInteger(Number(result.traysPerHourTarget)) ? Number(result.traysPerHourTarget) : Math.floor(Number(result.traysPerHourTarget));
892
+ }
893
+
894
+ return Number.isInteger(result.traysPerHourTarget) ? result.traysPerHourTarget : Math.floor(result.traysPerHourTarget);
895
+ }();
896
+ } else {
897
+ resultObject.traysPerHourTarget = null;
898
+ }
899
+
900
+ if (_typeof(result) === 'object' && 'costPerTrayActual' in result) {
901
+ resultObject.costPerTrayActual = function () {
902
+ if (typeof result.costPerTrayActual !== 'number') {
903
+ return Number(result.costPerTrayActual);
904
+ }
905
+
906
+ return result.costPerTrayActual;
907
+ }();
908
+ } else {
909
+ resultObject.costPerTrayActual = 0;
910
+ }
911
+
912
+ if (_typeof(result) === 'object' && 'costPerTrayTarget' in result) {
913
+ resultObject.costPerTrayTarget = function () {
914
+ if (result.costPerTrayTarget === null) {
915
+ return null;
916
+ }
917
+
918
+ if (typeof result.costPerTrayTarget !== 'number') {
919
+ return Number(result.costPerTrayTarget);
920
+ }
921
+
922
+ return result.costPerTrayTarget;
923
+ }();
924
+ } else {
925
+ resultObject.costPerTrayTarget = null;
926
+ }
927
+
928
+ if (_typeof(result) === 'object' && 'qualityR600IdealActual' in result) {
929
+ resultObject.qualityR600IdealActual = function () {
930
+ if (typeof result.qualityR600IdealActual !== 'number') {
931
+ return Number(result.qualityR600IdealActual);
932
+ }
933
+
934
+ return result.qualityR600IdealActual;
935
+ }();
936
+ } else {
937
+ resultObject.qualityR600IdealActual = 0;
938
+ }
939
+
940
+ if (_typeof(result) === 'object' && 'qualityR600IdealTarget' in result) {
941
+ resultObject.qualityR600IdealTarget = function () {
942
+ if (result.qualityR600IdealTarget === null) {
943
+ return null;
944
+ }
945
+
946
+ if (typeof result.qualityR600IdealTarget !== 'number') {
947
+ return Number(result.qualityR600IdealTarget);
948
+ }
949
+
950
+ return result.qualityR600IdealTarget;
951
+ }();
952
+ } else {
953
+ resultObject.qualityR600IdealTarget = null;
954
+ }
955
+
956
+ if (_typeof(result) === 'object' && 'customQualityMetrics' in result) {
957
+ resultObject.customQualityMetrics = function () {
958
+ if (Array.isArray(result.customQualityMetrics) !== true) {
959
+ return [];
960
+ }
961
+
962
+ return result.customQualityMetrics.map(function (customQualityMetricsItem) {
963
+ return function () {
964
+ var customQualityMetricsItemObject = {};
965
+
966
+ if (_typeof(customQualityMetricsItem) === 'object' && 'id' in customQualityMetricsItem) {
967
+ customQualityMetricsItemObject.id = function () {
968
+ if (typeof customQualityMetricsItem.id !== 'string') {
969
+ return String(customQualityMetricsItem.id);
970
+ }
971
+
972
+ return customQualityMetricsItem.id;
973
+ }();
974
+ } else {
975
+ customQualityMetricsItemObject.id = "";
976
+ }
977
+
978
+ if (_typeof(customQualityMetricsItem) === 'object' && 'name' in customQualityMetricsItem) {
979
+ customQualityMetricsItemObject.name = function () {
980
+ if (typeof customQualityMetricsItem.name !== 'string') {
981
+ return String(customQualityMetricsItem.name);
982
+ }
983
+
984
+ return customQualityMetricsItem.name;
985
+ }();
986
+ } else {
987
+ customQualityMetricsItemObject.name = "";
988
+ }
989
+
990
+ if (_typeof(customQualityMetricsItem) === 'object' && 'type' in customQualityMetricsItem) {
991
+ customQualityMetricsItemObject.type = function () {
992
+ if (typeof customQualityMetricsItem.type !== 'string') {
993
+ return String(customQualityMetricsItem.type);
994
+ }
995
+
996
+ return customQualityMetricsItem.type;
997
+ }();
998
+ } else {
999
+ customQualityMetricsItemObject.type = "";
1000
+ }
1001
+
1002
+ if (_typeof(customQualityMetricsItem) === 'object' && 'value' in customQualityMetricsItem) {
1003
+ customQualityMetricsItemObject.value = function () {
1004
+ if (typeof customQualityMetricsItem.value !== 'number') {
1005
+ return Number(customQualityMetricsItem.value);
1006
+ }
1007
+
1008
+ return customQualityMetricsItem.value;
1009
+ }();
1010
+ } else {
1011
+ customQualityMetricsItemObject.value = 0;
1012
+ }
1013
+
1014
+ if (_typeof(customQualityMetricsItem) === 'object' && 'target' in customQualityMetricsItem) {
1015
+ customQualityMetricsItemObject.target = function () {
1016
+ if (customQualityMetricsItem.target === null) {
1017
+ return null;
1018
+ }
1019
+
1020
+ if (typeof customQualityMetricsItem.target !== 'number') {
1021
+ return Number(customQualityMetricsItem.target);
1022
+ }
1023
+
1024
+ return customQualityMetricsItem.target;
1025
+ }();
1026
+ } else {
1027
+ customQualityMetricsItemObject.target = null;
1028
+ }
1029
+
1030
+ return customQualityMetricsItemObject;
1031
+ }();
1032
+ });
1033
+ }();
1034
+ } else {
1035
+ resultObject.customQualityMetrics = [];
1036
+ }
1037
+
1038
+ return resultObject;
1039
+ }();
1040
+
1041
+ resolve(resolveValue);
1042
+ }).catch(function (error) {
1043
+ return reject(error);
1044
+ });
1045
+ });
1046
+ }
779
1047
  /**
780
1048
  * List all Shifts [GET /packhouse/sites/{siteId}/shifts]
781
1049
  *
@@ -929,6 +1197,42 @@ var _default = ShiftController;
929
1197
  * @memberof Controllers.Packhouse.Site
930
1198
  */
931
1199
 
1200
+ /**
1201
+ * A **ScoreHistoryItem** Type
1202
+ *
1203
+ * @typedef {Object} ShiftController.ScoreHistoryItem
1204
+ * @property {Date} timestamp The Timestamp for the Score Percentage Value
1205
+ * @property {number} score The Score Value as a Percentage
1206
+ * @memberof Controllers.Packhouse.Site
1207
+ */
1208
+
1209
+ /**
1210
+ * A **CustomQualityMetricItem** Type
1211
+ *
1212
+ * @typedef {Object} ShiftController.CustomQualityMetricItem
1213
+ * @property {string} id The ID of this Custom Quality Metric Item
1214
+ * @property {string} name The Name of this Custom Quality Metric Item
1215
+ * @property {string} type The Display Type for this Custom Quality Metric Item
1216
+ * @property {number} value The Actual Value for this Custom Quality Metric Item
1217
+ * @property {?number} target The Target Value for this Custom Quality Metric Item
1218
+ * @memberof Controllers.Packhouse.Site
1219
+ */
1220
+
1221
+ /**
1222
+ * A **ShiftScoreMetrics** Type
1223
+ *
1224
+ * @typedef {Object} ShiftController.ShiftScoreMetrics
1225
+ * @property {number} scoreActual The Actual Score represented as a Percentage
1226
+ * @property {number} traysPerHourActual The Actual Tray Equivalents per Hour
1227
+ * @property {?number} traysPerHourTarget The Target Tray Equivalents per Hour
1228
+ * @property {number} costPerTrayActual The Actual Cost per Tray Equivalent represented in cents
1229
+ * @property {?number} costPerTrayTarget The Target Cost per Tray Equivalent represented in cents
1230
+ * @property {number} qualityR600IdealActual The Actual Quality R600 Ideal Samples represented as a Percentage
1231
+ * @property {?number} qualityR600IdealTarget The Target Quality R600 Ideal Samples represented as a Percentage
1232
+ * @property {Array<ShiftController.CustomQualityMetricItem>} customQualityMetrics An Array of Custom Quality Metric Items for the Shift
1233
+ * @memberof Controllers.Packhouse.Site
1234
+ */
1235
+
932
1236
  /**
933
1237
  * A **ShiftHandoverNote** Type
934
1238
  *
@@ -27,11 +27,13 @@ var _UserAccountActionTokenController = _interopRequireDefault(require("./UserAc
27
27
 
28
28
  var _UserAccountController = _interopRequireDefault(require("./UserAccountController"));
29
29
 
30
- var _index = _interopRequireDefault(require("./Packhouse/index"));
30
+ var _index = _interopRequireDefault(require("./Lab/index"));
31
31
 
32
- var _index2 = _interopRequireDefault(require("./RTU/index"));
32
+ var _index2 = _interopRequireDefault(require("./Packhouse/index"));
33
33
 
34
- var _index3 = _interopRequireDefault(require("./Site/index"));
34
+ var _index3 = _interopRequireDefault(require("./RTU/index"));
35
+
36
+ var _index4 = _interopRequireDefault(require("./Site/index"));
35
37
 
36
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
39
 
@@ -56,9 +58,10 @@ var Controllers = {
56
58
  ToolsController: _ToolsController.default,
57
59
  UserAccountActionTokenController: _UserAccountActionTokenController.default,
58
60
  UserAccountController: _UserAccountController.default,
59
- Packhouse: _index.default,
60
- RTU: _index2.default,
61
- Site: _index3.default
61
+ Lab: _index.default,
62
+ Packhouse: _index2.default,
63
+ RTU: _index3.default,
64
+ Site: _index4.default
62
65
  };
63
66
  var _default = Controllers;
64
67
  exports.default = _default;
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _BaseModel2 = _interopRequireDefault(require("../../../Models/BaseModel"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
+
14
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
+
16
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
+
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+
20
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
+
22
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
+
24
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
25
+
26
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
27
+
28
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
+
30
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
+
32
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33
+
34
+ /**
35
+ * Model Class for a Dehydrator
36
+ *
37
+ * @class
38
+ * @hideconstructor
39
+ * @extends BaseModel
40
+ */
41
+ var DehydratorModel = /*#__PURE__*/function (_BaseModel) {
42
+ _inherits(DehydratorModel, _BaseModel);
43
+
44
+ var _super = _createSuper(DehydratorModel);
45
+
46
+ /**
47
+ * DehydratorModel Constructor
48
+ *
49
+ * @protected
50
+ * @param {number} siteId The Site ID associated with this Dehydrator
51
+ */
52
+ function DehydratorModel(siteId) {
53
+ var _this;
54
+
55
+ _classCallCheck(this, DehydratorModel);
56
+
57
+ _this = _super.call(this);
58
+ /**
59
+ * The Dehydrator ID
60
+ *
61
+ * @type {string}
62
+ * @public
63
+ */
64
+
65
+ _this.id = "";
66
+ /**
67
+ * The RTU this Dehydrator belongs to
68
+ *
69
+ * @type {?number}
70
+ * @public
71
+ */
72
+
73
+ _this.rtuId = null;
74
+ /**
75
+ * The Name of this Dehydrator
76
+ *
77
+ * @type {string}
78
+ * @public
79
+ */
80
+
81
+ _this.name = "";
82
+ /**
83
+ * The Points used by this Dehydrator
84
+ *
85
+ * @type {{rackPositionId: number}}
86
+ * @public
87
+ */
88
+
89
+ _this.points = function () {
90
+ var pointsDefaultValue = {};
91
+ pointsDefaultValue.rackPositionId = 0;
92
+ return pointsDefaultValue;
93
+ }();
94
+ /**
95
+ * The Lab that owns this Dehydrator
96
+ *
97
+ * @type {string}
98
+ * @public
99
+ */
100
+
101
+
102
+ _this.labId = "";
103
+ /**
104
+ * Whether the Dehydrator has been deleted
105
+ *
106
+ * @type {boolean}
107
+ * @public
108
+ */
109
+
110
+ _this.deleted = false;
111
+ /**
112
+ * When the Dehydrator was last updated
113
+ *
114
+ * @type {Date}
115
+ * @public
116
+ */
117
+
118
+ _this.updateTimestamp = new Date();
119
+ /**
120
+ * The Site ID associated with this Dehydrator
121
+ *
122
+ * @type {number}
123
+ * @public
124
+ */
125
+
126
+ _this.siteId = siteId;
127
+ return _this;
128
+ }
129
+ /**
130
+ * Create a new **DehydratorModel** from a JSON Object or JSON String
131
+ *
132
+ * @static
133
+ * @public
134
+ * @param {Object<string, any>|string} json A JSON Object or JSON String
135
+ * @param {number} siteId The Site ID associated with this Dehydrator
136
+ * @return {DehydratorModel}
137
+ */
138
+
139
+
140
+ _createClass(DehydratorModel, null, [{
141
+ key: "fromJSON",
142
+ value: function fromJSON(json, siteId) {
143
+ var model = new DehydratorModel(siteId);
144
+ /**
145
+ * The JSON Object
146
+ *
147
+ * @type {Object<string, any>}
148
+ */
149
+
150
+ var jsonObject = {};
151
+
152
+ if (typeof json === 'string') {
153
+ jsonObject = JSON.parse(json);
154
+ } else if (_typeof(json) === 'object') {
155
+ jsonObject = json;
156
+ }
157
+
158
+ if ('id' in jsonObject) {
159
+ model.id = function () {
160
+ if (typeof jsonObject['id'] !== 'string') {
161
+ return String(jsonObject['id']);
162
+ }
163
+
164
+ return jsonObject['id'];
165
+ }();
166
+ }
167
+
168
+ if ('rtuId' in jsonObject) {
169
+ model.rtuId = function () {
170
+ if (jsonObject['rtuId'] === null) {
171
+ return null;
172
+ }
173
+
174
+ if (typeof jsonObject['rtuId'] !== 'number') {
175
+ return Number.isInteger(Number(jsonObject['rtuId'])) ? Number(jsonObject['rtuId']) : Math.floor(Number(jsonObject['rtuId']));
176
+ }
177
+
178
+ return Number.isInteger(jsonObject['rtuId']) ? jsonObject['rtuId'] : Math.floor(jsonObject['rtuId']);
179
+ }();
180
+ }
181
+
182
+ if ('name' in jsonObject) {
183
+ model.name = function () {
184
+ if (typeof jsonObject['name'] !== 'string') {
185
+ return String(jsonObject['name']);
186
+ }
187
+
188
+ return jsonObject['name'];
189
+ }();
190
+ }
191
+
192
+ if ('points' in jsonObject) {
193
+ model.points = function () {
194
+ var pointsObject = {};
195
+
196
+ if (_typeof(jsonObject['points']) === 'object' && 'rackPositionId' in jsonObject['points']) {
197
+ pointsObject.rackPositionId = function () {
198
+ if (typeof jsonObject['points'].rackPositionId !== 'number') {
199
+ return Number.isInteger(Number(jsonObject['points'].rackPositionId)) ? Number(jsonObject['points'].rackPositionId) : Math.floor(Number(jsonObject['points'].rackPositionId));
200
+ }
201
+
202
+ return Number.isInteger(jsonObject['points'].rackPositionId) ? jsonObject['points'].rackPositionId : Math.floor(jsonObject['points'].rackPositionId);
203
+ }();
204
+ } else {
205
+ pointsObject.rackPositionId = 0;
206
+ }
207
+
208
+ return pointsObject;
209
+ }();
210
+ }
211
+
212
+ if ('labId' in jsonObject) {
213
+ model.labId = function () {
214
+ if (typeof jsonObject['labId'] !== 'string') {
215
+ return String(jsonObject['labId']);
216
+ }
217
+
218
+ return jsonObject['labId'];
219
+ }();
220
+ }
221
+
222
+ if ('deleted' in jsonObject) {
223
+ model.deleted = function () {
224
+ if (typeof jsonObject['deleted'] !== 'boolean') {
225
+ return Boolean(jsonObject['deleted']);
226
+ }
227
+
228
+ return jsonObject['deleted'];
229
+ }();
230
+ }
231
+
232
+ if ('updateTimestamp' in jsonObject) {
233
+ model.updateTimestamp = function () {
234
+ if (typeof jsonObject['updateTimestamp'] !== 'string') {
235
+ return new Date(String(jsonObject['updateTimestamp']));
236
+ }
237
+
238
+ return new Date(jsonObject['updateTimestamp']);
239
+ }();
240
+ }
241
+
242
+ return model;
243
+ }
244
+ }]);
245
+
246
+ return DehydratorModel;
247
+ }(_BaseModel2.default);
248
+
249
+ var _default = DehydratorModel;
250
+ exports.default = _default;