context: // ===================================================================================================
  //                           _  __     _ _
  //                          | |/ /__ _| | |_ _  _ _ _ __ _
  //                          | ' </ _` | |  _| || | '_/ _` |
  //                          |_|\_\__,_|_|\__|\_,_|_| \__,_|
  //
  // This file is part of the Kaltura Collaborative Media Suite which allows users
  // to do with audio, video, and animation what Wiki platforms allow them to do with
  // text.
  //
  // Copyright (C) 2006-2022  Kaltura Inc.
  //
  // This program is free software: you can redistribute it and/or modify
  // it under the terms of the GNU Affero General Public License as
  // published by the Free Software Foundation, either version 3 of the
  // License, or (at your option) any later version.
  //
  // This program is distributed in the hope that it will be useful,
  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  // GNU Affero General Public License for more details.
  //
  // You should have received a copy of the GNU Affero General Public License
  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
  //
  // @ignore
  // ===================================================================================================
  using System;
  using System.Xml;
  using System.Collections.Generic;
  using Kaltura.Enums;
  using Kaltura.Request;
  using Newtonsoft.Json;
  using Newtonsoft.Json.Linq;
  
  namespace Kaltura.Types
  {
  	public class SchedulerWorker : ObjectBase
  	{
  		#region Constants
  		public const string ID = "id";
  		public const string CONFIGURED_ID = "configuredId";
  		public const string SCHEDULER_ID = "schedulerId";
  		public const string SCHEDULER_CONFIGURED_ID = "schedulerConfiguredId";
  		public const string TYPE = "type";
  		public const string TYPE_NAME = "typeName";
  		public const string NAME = "name";
  		public const string STATUSES = "statuses";
  		public const string CONFIGS = "configs";
  		public const string LOCKED_JOBS = "lockedJobs";
  		public const string AVG_WAIT = "avgWait";
  		public const string AVG_WORK = "avgWork";
  		public const string LAST_STATUS = "lastStatus";
  		public const string LAST_STATUS_STR = "lastStatusStr";
  		#endregion
  
  		#region Private Fields
  		private int _Id = Int32.MinValue;
  		private int _ConfiguredId = Int32.MinValue;
  		private int _SchedulerId = Int32.MinValue;
  		private int _SchedulerConfiguredId = Int32.MinValue;
  		private BatchJobType _Type = null;
  		private string _TypeName = null;
  		private string _Name = null;
  		private IList<SchedulerStatus> _Statuses;
  		private IList<SchedulerConfig> _Configs;
  		private IList<BatchJob> _LockedJobs;
  		private int _AvgWait = Int32.MinValue;
  		private int _AvgWork = Int32.MinValue;
  		private int _LastStatus = Int32.MinValue;
  		private string _LastStatusStr = null;
  		#endregion
  
  		#region Properties
  		/// <summary>
  		/// Use IdAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int Id
  		{
  			get { return _Id; }
  			private set 
  			{ 
  				_Id = value;
  				OnPropertyChanged("Id");
  			}
  		}
  		/// <summary>
  		/// Use ConfiguredIdAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int ConfiguredId
  		{
  			get { return _ConfiguredId; }
  			set 
  			{ 
  				_ConfiguredId = value;
  				OnPropertyChanged("ConfiguredId");
  			}
  		}
  		/// <summary>
  		/// Use SchedulerIdAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int SchedulerId
  		{
  			get { return _SchedulerId; }
  			set 
  			{ 
  				_SchedulerId = value;
  				OnPropertyChanged("SchedulerId");
  			}
  		}
  		/// <summary>
  		/// Use SchedulerConfiguredIdAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int SchedulerConfiguredId
  		{
  			get { return _SchedulerConfiguredId; }
  			set 
  			{ 
  				_SchedulerConfiguredId = value;
  				OnPropertyChanged("SchedulerConfiguredId");
  			}
  		}
  		/// <summary>
  		/// Use TypeAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public BatchJobType Type
  		{
  			get { return _Type; }
  			set 
  			{ 
  				_Type = value;
  				OnPropertyChanged("Type");
  			}
  		}
  		/// <summary>
  		/// Use TypeNameAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public string TypeName
  		{
  			get { return _TypeName; }
  			set 
  			{ 
  				_TypeName = value;
  				OnPropertyChanged("TypeName");
  			}
  		}
  		/// <summary>
  		/// Use NameAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public string Name
  		{
  			get { return _Name; }
  			set 
  			{ 
  				_Name = value;
  				OnPropertyChanged("Name");
  			}
  		}
  		/// <summary>
  		/// Use StatusesAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public IList<SchedulerStatus> Statuses
  		{
  			get { return _Statuses; }
  			set 
  			{ 
  				_Statuses = value;
  				OnPropertyChanged("Statuses");
  			}
  		}
  		/// <summary>
  		/// Use ConfigsAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public IList<SchedulerConfig> Configs
  		{
  			get { return _Configs; }
  			set 
  			{ 
  				_Configs = value;
  				OnPropertyChanged("Configs");
  			}
  		}
  		/// <summary>
  		/// Use LockedJobsAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public IList<BatchJob> LockedJobs
  		{
  			get { return _LockedJobs; }
  			set 
  			{ 
  				_LockedJobs = value;
  				OnPropertyChanged("LockedJobs");
  			}
  		}
  		/// <summary>
  		/// Use AvgWaitAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int AvgWait
  		{
  			get { return _AvgWait; }
  			set 
  			{ 
  				_AvgWait = value;
  				OnPropertyChanged("AvgWait");
  			}
  		}
  		/// <summary>
  		/// Use AvgWorkAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int AvgWork
  		{
  			get { return _AvgWork; }
  			set 
  			{ 
  				_AvgWork = value;
  				OnPropertyChanged("AvgWork");
  			}
  		}
  		/// <summary>
  		/// Use LastStatusAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public int LastStatus
  		{
  			get { return _LastStatus; }
  			set 
  			{ 
  				_LastStatus = value;
  				OnPropertyChanged("LastStatus");
  			}
  		}
  		/// <summary>
  		/// Use LastStatusStrAsDouble property instead
  		/// </summary>
  		[JsonProperty]
  		public string LastStatusStr
  		{
  			get { return _LastStatusStr; }
  			set 
  			{ 
  				_LastStatusStr = value;
  				OnPropertyChanged("LastStatusStr");
  			}
  		}
  		#endregion
  
  		#region CTor
  		public SchedulerWorker()
  		{
  		}
  
  		public SchedulerWorker(JToken node) : base(node)
  		{
  			if(node["id"] != null)
  			{
  				this._Id = ParseInt(node["id"].Value<string>());
  			}
  			if(node["configuredId"] != null)
  			{
  				this._ConfiguredId = ParseInt(node["configuredId"].Value<string>());
  			}
  			if(node["schedulerId"] != null)
  			{
  				this._SchedulerId = ParseInt(node["schedulerId"].Value<string>());
  			}
  			if(node["schedulerConfiguredId"] != null)
  			{
  				this._SchedulerConfiguredId = ParseInt(node["schedulerConfiguredId"].Value<string>());
  			}
  			if(node["type"] != null)
  			{
  				this._Type = (BatchJobType)StringEnum.Parse(typeof(BatchJobType), node["type"].Value<string>());
  			}
  			if(node["typeName"] != null)
  			{
  				this._TypeName = node["typeName"].Value<string>();
  			}
  			if(node["name"] != null)
  			{
  				this._Name = node["name"].Value<string>();
  			}
  			if(node["statuses"] != null)
  			{
  				this._Statuses = new List<SchedulerStatus>();
  				foreach(var arrayNode in node["statuses"].Children())
  				{
  					this._Statuses.Add(ObjectFactory.Create<SchedulerStatus>(arrayNode));
  				}
  			}
  			if(node["configs"] != null)
  			{
  				this._Configs = new List<SchedulerConfig>();
  				foreach(var arrayNode in node["configs"].Children())
  				{
  					this._Configs.Add(ObjectFactory.Create<SchedulerConfig>(arrayNode));
  				}
  			}
  			if(node["lockedJobs"] != null)
  			{
  				this._LockedJobs = new List<BatchJob>();
  				foreach(var arrayNode in node["lockedJobs"].Children())
  				{
  					this._LockedJobs.Add(ObjectFactory.Create<BatchJob>(arrayNode));
  				}
  			}
  			if(node["avgWait"] != null)
  			{
  				this._AvgWait = ParseInt(node["avgWait"].Value<string>());
  			}
  			if(node["avgWork"] != null)
  			{
  				this._AvgWork = ParseInt(node["avgWork"].Value<string>());
  			}
  			if(node["lastStatus"] != null)
  			{
  				this._LastStatus = ParseInt(node["lastStatus"].Value<string>());
  			}
  			if(node["lastStatusStr"] != null)
  			{
  
gt: 				this._LastStatusStr = node["lastStatusStr"].Value<string>();