/**
* 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 Soft Sort Belt
*
* @class
* @hideconstructor
* @extends BaseModel
*/
class SoftSortBeltModel extends BaseModel
{
/**
* SoftSortBeltModel Constructor
*
* @protected
* @param {number} siteId The Site ID associated with this Soft Sort Belt
*/
constructor(siteId)
{
super();
/**
* The Soft Sort Belt ID
*
* @type {string}
* @public
*/
this.id = "";
/**
* The RTU this Soft Sort Belt belongs to
*
* @type {?number}
* @public
*/
this.rtuId = null;
/**
* The Name of this Soft Sort Belt
*
* @type {string}
* @public
*/
this.name = "";
/**
* The Points used by this Soft Sort Belt
*
* @type {{runAuto: number, slowMode: ?number, stopMode: number}}
* @public
*/
this.points = (function(){
let pointsDefaultValue = {};
pointsDefaultValue.runAuto = 0;
pointsDefaultValue.slowMode = null;
pointsDefaultValue.stopMode = 0;
return pointsDefaultValue;
}());
/**
* The Packing Line that owns this Soft Sort Belt
*
* @type {string}
* @public
*/
this.packingLineId = "";
/**
* Whether the Soft Sort Belt has been deleted
*
* @type {boolean}
* @public
*/
this.deleted = false;
/**
* When the Soft Sort Belt was last updated
*
* @type {Date}
* @public
*/
this.updateTimestamp = new Date();
/**
* The Site ID associated with this Soft Sort Belt
*
* @type {number}
* @public
*/
this.siteId = siteId;
}
/**
* Create a new **SoftSortBeltModel** 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 Soft Sort Belt
* @return {SoftSortBeltModel}
*/
static fromJSON(json, siteId)
{
let model = new SoftSortBeltModel(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('rtuId' in jsonObject)
{
model.rtuId = (function(){
if(jsonObject['rtuId'] === null)
{
return null;
}
if(typeof jsonObject['rtuId'] !== 'number')
{
return Number.isInteger(Number(jsonObject['rtuId'])) ? Number(jsonObject['rtuId']) : Math.floor(Number(jsonObject['rtuId']));
}
return Number.isInteger(jsonObject['rtuId']) ? jsonObject['rtuId'] : Math.floor(jsonObject['rtuId']);
}());
}
if('name' in jsonObject)
{
model.name = (function(){
if(typeof jsonObject['name'] !== 'string')
{
return String(jsonObject['name']);
}
return jsonObject['name'];
}());
}
if('points' in jsonObject)
{
model.points = (function(){
let pointsObject = {};
if(typeof jsonObject['points'] === 'object' && 'runAuto' in jsonObject['points'])
{
pointsObject.runAuto = (function(){
if(typeof jsonObject['points'].runAuto !== 'number')
{
return Number.isInteger(Number(jsonObject['points'].runAuto)) ? Number(jsonObject['points'].runAuto) : Math.floor(Number(jsonObject['points'].runAuto));
}
return Number.isInteger(jsonObject['points'].runAuto) ? jsonObject['points'].runAuto : Math.floor(jsonObject['points'].runAuto);
}());
}
else
{
pointsObject.runAuto = 0;
}
if(typeof jsonObject['points'] === 'object' && 'slowMode' in jsonObject['points'])
{
pointsObject.slowMode = (function(){
if(jsonObject['points'].slowMode === null)
{
return null;
}
if(typeof jsonObject['points'].slowMode !== 'number')
{
return Number.isInteger(Number(jsonObject['points'].slowMode)) ? Number(jsonObject['points'].slowMode) : Math.floor(Number(jsonObject['points'].slowMode));
}
return Number.isInteger(jsonObject['points'].slowMode) ? jsonObject['points'].slowMode : Math.floor(jsonObject['points'].slowMode);
}());
}
else
{
pointsObject.slowMode = null;
}
if(typeof jsonObject['points'] === 'object' && 'stopMode' in jsonObject['points'])
{
pointsObject.stopMode = (function(){
if(typeof jsonObject['points'].stopMode !== 'number')
{
return Number.isInteger(Number(jsonObject['points'].stopMode)) ? Number(jsonObject['points'].stopMode) : Math.floor(Number(jsonObject['points'].stopMode));
}
return Number.isInteger(jsonObject['points'].stopMode) ? jsonObject['points'].stopMode : Math.floor(jsonObject['points'].stopMode);
}());
}
else
{
pointsObject.stopMode = 0;
}
return pointsObject;
}());
}
if('packingLineId' in jsonObject)
{
model.packingLineId = (function(){
if(typeof jsonObject['packingLineId'] !== 'string')
{
return String(jsonObject['packingLineId']);
}
return jsonObject['packingLineId'];
}());
}
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 SoftSortBeltModel;
source