text: /**
   * 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 Packrun
   * 
   * @class
   * @hideconstructor
   * @extends BaseModel
   */
  class PackrunModel extends BaseModel
  {
      /**
       * PackrunModel Constructor
       * 
       * @protected
       */
      constructor()
      {
          super();
          
          /**
           * The Packrun ID
           * 
           * @type {string}
           * @public
           */
          this.id = undefined;
          
          /**
           * The Packing Line ID this Packrun is associated with
           * 
           * @type {string}
           * @public
           */
          this.packingLineId = undefined;
          
          /**
           * The Packrun Name
           * 
           * @type {string}
           * @public
           */
          this.name = undefined;
          
          /**
           * When this Packrun was Created
           * 
           * @type {Date}
           * @public
           */
          this.createdTimestamp = undefined;
          
          /**
           * The Grower Name for this Packrun
           * 
           * @type {string}
           * @public
           */
          this.growerName = undefined;
          
          /**
           * The Grower Code for this Packrun
           * 
           * @type {string}
           * @public
           */
          this.growerCode = undefined;
          
          /**
           * The Maturity Area for this Packrun
           * 
           * @type {string}
           * @public
           */
          this.maturityArea = undefined;
          
          /**
           * When this Packrun was Started
           * 
           * @type {?Date}
           * @public
           */
          this.startTimestamp = undefined;
          
          /**
           * When this Packrun was Finished
           * 
           * @type {?Date}
           * @public
           */
          this.finishTimestamp = undefined;
          
          /**
           * The Variety for this Packrun
           * 
           * @type {string}
           * @public
           */
          this.varietyId = undefined;
          
          /**
           * The Growing Method for this Packrun
           * 
           * @type {?string}
           * @public
           */
          this.growingMethodId = undefined;
          
          /**
           * The Number of Allocated Bins for this Packrun
           * 
           * @type {number}
           * @public
           */
          this.allocatedBins = undefined;
          
          /**
           * The Time Batches for this Packrun
           * 
           * @type {Object[]}
           * @public
           */
          this.timeBatches = undefined;
          
          /**
           * Whether the Packrun has been deleted
           * 
           * @type {boolean}
           * @public
           */
          this.deleted = undefined;
          
          /**
           * When the Packrun was last updated
           * 
           * @type {Date}
           * @public
           */
          this.updateTimestamp = undefined;
      }
  
      /**
       * Create a new **PackrunModel** from a JSON Object or JSON String
       * 
       * @static
       * @public
       * @param {Object<string, any>|string} json A JSON Object or JSON String
       * @return {PackrunModel}
       */
      static fromJSON(json)
      {
          let model = new PackrunModel();
          
          /**
           * 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('packingLineId' in jsonObject)
          {
              model.packingLineId = (function(){
                  if(typeof jsonObject['packingLineId'] !== 'string')
                  {
                      return String(jsonObject['packingLineId']);
                  }
          
                  return jsonObject['packingLineId'];
              }());
          }
          
          if('name' in jsonObject)
          {
              model.name = (function(){
                  if(typeof jsonObject['name'] !== 'string')
                  {
                      return String(jsonObject['name']);
                  }
          
                  return jsonObject['name'];
              }());
          }
          
          if('createdTimestamp' in jsonObject)
          {
              model.createdTimestamp = (function(){
                  if(typeof jsonObject['createdTimestamp'] !== 'string')
                  {
                      return new Date(String(jsonObject['createdTimestamp']));
                  }
          
                  return new Date(jsonObject['createdTimestamp']);
              }());
          }
          
          if('growerName' in jsonObject)
          {
              model.growerName = (function(){
                  if(typeof jsonObject['growerName'] !== 'string')
                  {
                      return String(jsonObject['growerName']);
                  }
          
                  return jsonObject['growerName'];
              }());
          }
          
          if('growerCode' in jsonObject)
          {
              model.growerCode = (function(){
                  if(typeof jsonObject['growerCode'] !== 'string')
                  {
                      return String(jsonObject['growerCode']);
                  }
          
                  return jsonObject['growerCode'];
              }());
          }
          
          if('maturityArea' in jsonObject)
          {
              model.maturityArea = (function(){
                  if(typeof jsonObject['maturityArea'] !== 'string')
                  {
                      return String(jsonObject['maturityArea']);
                  }
          
                  return jsonObject['maturityArea'];
              }());
          }
          
          if('startTimestamp' in jsonObject)
          {
              model.startTimestamp = (function(){
                  if(jsonObject['startTimestamp'] === null)
                  {
                      return null;
                  }
          
                  if(typeof jsonObject['startTimestamp'] !== 'string')
                  {
                      return new Date(String(jsonObject['startTimestamp']));
                  }
          
                  return new Date(jsonObject['startTimestamp']);
              }());
          }
          
          if('finishTimestamp' in jsonObject)
          {
              model.finishTimestamp = (function(){
                  if(jsonObject['finishTimestamp'] === null)
                  {
                      return null;
                  }
          
                  if(typeof jsonObject['finishTimestamp'] !== 'string')
                  {
                      return new Date(String(jsonObject['finishTimestamp']));
                  }
          
                  return new Date(jsonObject['finishTimestamp']);
              }());
          }
          
          if('varietyId' in jsonObject)
          {
              model.varietyId = (function(){
                  if(typeof jsonObject['varietyId'] !== 'string')
                  {
                      return String(jsonObject['varietyId']);
                  }
          
                  return jsonObject['varietyId'];
              }());
          }
          
          if('growingMethodId' in jsonObject)
          {
              model.growingMethodId = (function(){
                  if(jsonObject['growingMethodId'] === null)
                  {
                      return null;
                  }
          
                  if(typeof jsonObject['growingMethodId'] !== 'string')
                  {
                      return String(jsonObject['growingMethodId']);
                  }
          
                  return jsonObject['growingMethodId'];
              }());
          }
          
          if('allocatedBins' in jsonObject)
          {
              model.allocatedBins = (function(){
                  if(typeof jsonObject['allocatedBins'] !== 'number')
                  {
                      return Number.isInteger(Number(jsonObject['allocatedBins'])) ? Number(jsonObject['allocatedBins']) : Math.floor(Number(jsonObject['allocatedBins']));
                  }
          
                  return Number.isInteger(jsonObject['allocatedBins']) ? jsonObject['allocatedBins'] : Math.floor(jsonObject['allocatedBins']);
              }());
          }
          
          if('timeBatches' in jsonObject)
          {
              model.timeBatches = (function(){
                  if(Array.isArray(jsonObject['timeBatches']) !== true)
                  {
                      return [];
                  }
          
                  return jsonObject['timeBatches'].map((timeBatchesItem) => {
                      return (function(){
                          if(typeof timeBatchesItem !== 'object')
                          {
                              return Object(timeBatchesItem);
                          }
          
                          return timeBatchesItem;
                      }());
                  });
              }());
          }
          
          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 PackrunModel;