/**
* 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 Bin Tip Bin Card
*
* @class
* @hideconstructor
* @extends BaseModel
*/
class BinTipBinCardModel extends BaseModel
{
/**
* BinTipBinCardModel Constructor
*
* @protected
* @param {number} siteId The Site ID associated with this Bin Tip Bin Card
*/
constructor(siteId)
{
super();
/**
* The Bin Tip Bin Card ID
*
* @type {string}
* @public
*/
this.id = "";
/**
* The Bin Tip ID associated with this Bin Card
*
* @type {string}
* @public
*/
this.binTipId = "";
/**
* The Bin ID associated with this Bin Card
*
* @type {string}
* @public
*/
this.binTipBinId = "";
/**
* When this Bin Card was Created
*
* @type {Date}
* @public
*/
this.createdTimestamp = new Date();
/**
* A Base64 Encoded Image of the Bin Card
*
* @type {?string}
* @public
*/
this.image = null;
/**
* Whether the Bin Tip Bin Card has been deleted
*
* @type {boolean}
* @public
*/
this.deleted = false;
/**
* When the Bin Tip Bin Card was last updated
*
* @type {Date}
* @public
*/
this.updateTimestamp = new Date();
/**
* The Site ID associated with this Bin Tip Bin Card
*
* @type {number}
* @public
*/
this.siteId = siteId;
}
/**
* Create a new **BinTipBinCardModel** 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 Bin Tip Bin Card
* @return {BinTipBinCardModel}
*/
static fromJSON(json, siteId)
{
let model = new BinTipBinCardModel(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('binTipId' in jsonObject)
{
model.binTipId = (function(){
if(typeof jsonObject['binTipId'] !== 'string')
{
return String(jsonObject['binTipId']);
}
return jsonObject['binTipId'];
}());
}
if('binTipBinId' in jsonObject)
{
model.binTipBinId = (function(){
if(typeof jsonObject['binTipBinId'] !== 'string')
{
return String(jsonObject['binTipBinId']);
}
return jsonObject['binTipBinId'];
}());
}
if('createdTimestamp' in jsonObject)
{
model.createdTimestamp = (function(){
if(typeof jsonObject['createdTimestamp'] !== 'string')
{
return new Date(String(jsonObject['createdTimestamp']));
}
return new Date(jsonObject['createdTimestamp']);
}());
}
if('image' in jsonObject)
{
model.image = (function(){
if(jsonObject['image'] === null)
{
return null;
}
if(typeof jsonObject['image'] !== 'string')
{
return String(jsonObject['image']);
}
return jsonObject['image'];
}());
}
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 BinTipBinCardModel;
source