/**
* File Auto-Generated by the RICADO Gen 4 PHP API Project
*
* Do Not Edit this File Manually!
*/
import BaseModel from '../../../Models/BaseModel';
/**
* Model Class for a Probe Calibration
*
* @class
* @hideconstructor
* @extends BaseModel
*/
class ProbeCalibrationModel extends BaseModel
{
/**
* ProbeCalibrationModel Constructor
*
* @protected
* @param {number} siteId The Site ID associated with this Probe Calibration
*/
constructor(siteId)
{
super();
/**
* The Probe Calibration ID
*
* @type {string}
* @public
*/
this.id = "";
/**
* The Rack Position ID this Probe Calibration is associated with
*
* @type {string}
* @public
*/
this.rackPositionId = "";
/**
* When this Probe Calibration was Created
*
* @type {Date}
* @public
*/
this.createdTimestamp = new Date();
/**
* ID of the User who Completed this Probe Calibration
*
* @type {string}
* @public
*/
this.userId = "";
/**
* Name of the User who Completed this Probe Calibration
*
* @type {string}
* @public
*/
this.userName = "";
/**
* The Calibration Offset prior to this Probe Calibration being Created
*
* @type {number}
* @public
*/
this.preCalibrationOffset = 0;
/**
* The Calibration Offset after this Probe Calibration was Created
*
* @type {number}
* @public
*/
this.postCalibrationOffset = 0;
/**
* The Temperature Probe reading prior to this Probe Calibration being Created
*
* @type {number}
* @public
*/
this.preCalibrationTemperature = 0;
/**
* The Temperature Probe reading after this Probe Calibration was Created
*
* @type {number}
* @public
*/
this.postCalibrationTemperature = 0;
/**
* Whether the Probe Calibration has been deleted
*
* @type {boolean}
* @public
*/
this.deleted = false;
/**
* When the Probe Calibration was last updated
*
* @type {Date}
* @public
*/
this.updateTimestamp = new Date();
/**
* The Site ID associated with this Probe Calibration
*
* @type {number}
* @public
*/
this.siteId = siteId;
}
/**
* Create a new **ProbeCalibrationModel** from a JSON Object or JSON String
*
* @static
* @public
* @param {Object<string, any>|string} json A JSON Object or JSON String
* @param {number} siteId The Site ID associated with this Probe Calibration
* @return {ProbeCalibrationModel}
*/
static fromJSON(json, siteId)
{
let model = new ProbeCalibrationModel(siteId);
/**
* The JSON Object
*
* @type {Object<string, any>}
*/
let jsonObject = {};
if(typeof json === 'string')
{
jsonObject = JSON.parse(json);
}
else if(typeof json === 'object')
{
jsonObject = json;
}
if('id' in jsonObject)
{
model.id = (function(){
if(typeof jsonObject['id'] !== 'string')
{
return String(jsonObject['id']);
}
return jsonObject['id'];
}());
}
if('rackPositionId' in jsonObject)
{
model.rackPositionId = (function(){
if(typeof jsonObject['rackPositionId'] !== 'string')
{
return String(jsonObject['rackPositionId']);
}
return jsonObject['rackPositionId'];
}());
}
if('createdTimestamp' in jsonObject)
{
model.createdTimestamp = (function(){
if(typeof jsonObject['createdTimestamp'] !== 'string')
{
return new Date(String(jsonObject['createdTimestamp']));
}
return new Date(jsonObject['createdTimestamp']);
}());
}
if('userId' in jsonObject)
{
model.userId = (function(){
if(typeof jsonObject['userId'] !== 'string')
{
return String(jsonObject['userId']);
}
return jsonObject['userId'];
}());
}
if('userName' in jsonObject)
{
model.userName = (function(){
if(typeof jsonObject['userName'] !== 'string')
{
return String(jsonObject['userName']);
}
return jsonObject['userName'];
}());
}
if('preCalibrationOffset' in jsonObject)
{
model.preCalibrationOffset = (function(){
if(typeof jsonObject['preCalibrationOffset'] !== 'number')
{
return Number(jsonObject['preCalibrationOffset']);
}
return jsonObject['preCalibrationOffset'];
}());
}
if('postCalibrationOffset' in jsonObject)
{
model.postCalibrationOffset = (function(){
if(typeof jsonObject['postCalibrationOffset'] !== 'number')
{
return Number(jsonObject['postCalibrationOffset']);
}
return jsonObject['postCalibrationOffset'];
}());
}
if('preCalibrationTemperature' in jsonObject)
{
model.preCalibrationTemperature = (function(){
if(typeof jsonObject['preCalibrationTemperature'] !== 'number')
{
return Number(jsonObject['preCalibrationTemperature']);
}
return jsonObject['preCalibrationTemperature'];
}());
}
if('postCalibrationTemperature' in jsonObject)
{
model.postCalibrationTemperature = (function(){
if(typeof jsonObject['postCalibrationTemperature'] !== 'number')
{
return Number(jsonObject['postCalibrationTemperature']);
}
return jsonObject['postCalibrationTemperature'];
}());
}
if('deleted' in jsonObject)
{
model.deleted = (function(){
if(typeof jsonObject['deleted'] !== 'boolean')
{
return Boolean(jsonObject['deleted']);
}
return jsonObject['deleted'];
}());
}
if('updateTimestamp' in jsonObject)
{
model.updateTimestamp = (function(){
if(typeof jsonObject['updateTimestamp'] !== 'string')
{
return new Date(String(jsonObject['updateTimestamp']));
}
return new Date(jsonObject['updateTimestamp']);
}());
}
return model;
}
}
export default ProbeCalibrationModel;
source