// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool Xbim.CodeGeneration 
//  
//     Changes to this file may cause incorrect behaviour and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

using Xbim.Ifc4.Interfaces;
using System.Collections.Generic;
using System.Linq;
using Xbim.Common;

//## Custom using statements
//##

// ReSharper disable once CheckNamespace
namespace Xbim.Ifc4x3.DateTimeResource
{
	public partial class @IfcSchedulingTime : IIfcSchedulingTime
	{

		[CrossSchemaAttribute(typeof(IIfcSchedulingTime), 1)]
		Ifc4.MeasureResource.IfcLabel? IIfcSchedulingTime.Name 
		{ 
			get
			{
				if (!Name.HasValue) return null;
				return new Ifc4.MeasureResource.IfcLabel(Name.Value);
			} 
			set
			{
				Name = value.HasValue ? 
					new MeasureResource.IfcLabel(value.Value) :  
					 new MeasureResource.IfcLabel?() ;
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcSchedulingTime), 2)]
		Ifc4.Interfaces.IfcDataOriginEnum? IIfcSchedulingTime.DataOrigin 
		{ 
			get
			{
				//## Custom code to handle enumeration of DataOrigin
				//##
				switch (DataOrigin)
				{
					case IfcDataOriginEnum.MEASURED:
						return Ifc4.Interfaces.IfcDataOriginEnum.MEASURED;
					case IfcDataOriginEnum.PREDICTED:
						return Ifc4.Interfaces.IfcDataOriginEnum.PREDICTED;
					case IfcDataOriginEnum.SIMULATED:
						return Ifc4.Interfaces.IfcDataOriginEnum.SIMULATED;
					case IfcDataOriginEnum.USERDEFINED:
						//## Optional custom handling of DataOrigin == .USERDEFINED. 
						//##
						return Ifc4.Interfaces.IfcDataOriginEnum.USERDEFINED;
					case IfcDataOriginEnum.NOTDEFINED:
						return Ifc4.Interfaces.IfcDataOriginEnum.NOTDEFINED;
					case null: 
						return null;
					
					default:
						throw new System.ArgumentOutOfRangeException();
				}
			} 
			set
			{
				//## Custom code to handle setting of enumeration of DataOrigin
				//##
				switch (value)
				{
					case Ifc4.Interfaces.IfcDataOriginEnum.MEASURED:
						DataOrigin = IfcDataOriginEnum.MEASURED;
						return;
					case Ifc4.Interfaces.IfcDataOriginEnum.PREDICTED:
						DataOrigin = IfcDataOriginEnum.PREDICTED;
						return;
					case Ifc4.Interfaces.IfcDataOriginEnum.SIMULATED:
						DataOrigin = IfcDataOriginEnum.SIMULATED;
						return;
					case Ifc4.Interfaces.IfcDataOriginEnum.USERDEFINED:
						DataOrigin = IfcDataOriginEnum.USERDEFINED;
						return;
					case Ifc4.Interfaces.IfcDataOriginEnum.NOTDEFINED:
						DataOrigin = IfcDataOriginEnum.NOTDEFINED;
						return;
					
					case null:
						DataOrigin = null;
						return;
					default:
						throw new System.ArgumentOutOfRangeException();
				}
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcSchedulingTime), 3)]
		Ifc4.MeasureResource.IfcLabel? IIfcSchedulingTime.UserDefinedDataOrigin 
		{ 
			get
			{
				if (!UserDefinedDataOrigin.HasValue) return null;
				return new Ifc4.MeasureResource.IfcLabel(UserDefinedDataOrigin.Value);
			} 
			set
			{
				UserDefinedDataOrigin = value.HasValue ? 
					new MeasureResource.IfcLabel(value.Value) :  
					 new MeasureResource.IfcLabel?() ;
				
			}
		}
	//## Custom code
	//##
	}
}