// ------------------------------------------------------------------------------
// <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;

// ReSharper disable once CheckNamespace
namespace Xbim.Ifc2x3.ProductExtension
{
	public partial class @IfcTransportElementType : IIfcTransportElementType
	{

		[CrossSchemaAttribute(typeof(IIfcTransportElementType), 10)]
		Ifc4.Interfaces.IfcTransportElementTypeEnum IIfcTransportElementType.PredefinedType 
		{ 
			get
			{
				//## Custom code to handle enumeration of PredefinedType
				//##
				switch (PredefinedType)
				{
					case IfcTransportElementTypeEnum.ELEVATOR:
						return Ifc4.Interfaces.IfcTransportElementTypeEnum.ELEVATOR;
					case IfcTransportElementTypeEnum.ESCALATOR:
						return Ifc4.Interfaces.IfcTransportElementTypeEnum.ESCALATOR;
					case IfcTransportElementTypeEnum.MOVINGWALKWAY:
						return Ifc4.Interfaces.IfcTransportElementTypeEnum.MOVINGWALKWAY;
					case IfcTransportElementTypeEnum.USERDEFINED:
						//## Optional custom handling of PredefinedType == .USERDEFINED. 
                        if (ElementType.HasValue)
                        {
                            Ifc4.Interfaces.IfcTransportElementTypeEnum result;
                            if (System.Enum.TryParse(ElementType.Value, false, out result))
                                return result;
                        }
						//##
						return Ifc4.Interfaces.IfcTransportElementTypeEnum.USERDEFINED;
					case IfcTransportElementTypeEnum.NOTDEFINED:
						return Ifc4.Interfaces.IfcTransportElementTypeEnum.NOTDEFINED;
					
					default:
						throw new System.ArgumentOutOfRangeException();
				}
			} 
			set
			{
				//## Custom code to handle setting of enumeration of PredefinedType
				//##
				switch (value)
				{
					case Ifc4.Interfaces.IfcTransportElementTypeEnum.ELEVATOR:
						PredefinedType = IfcTransportElementTypeEnum.ELEVATOR;
						return;
					case Ifc4.Interfaces.IfcTransportElementTypeEnum.ESCALATOR:
						PredefinedType = IfcTransportElementTypeEnum.ESCALATOR;
						return;
					case Ifc4.Interfaces.IfcTransportElementTypeEnum.MOVINGWALKWAY:
						PredefinedType = IfcTransportElementTypeEnum.MOVINGWALKWAY;
						return;
					case Ifc4.Interfaces.IfcTransportElementTypeEnum.CRANEWAY:
						//## Handle setting of CRANEWAY member from IfcTransportElementTypeEnum in property PredefinedType
						ElementType = value.ToString();
                        PredefinedType = IfcTransportElementTypeEnum.USERDEFINED;
				        return;
						//##
										case Ifc4.Interfaces.IfcTransportElementTypeEnum.LIFTINGGEAR:
						//## Handle setting of LIFTINGGEAR member from IfcTransportElementTypeEnum in property PredefinedType
						ElementType = value.ToString();
                        PredefinedType = IfcTransportElementTypeEnum.USERDEFINED;
				        return;
						//##
										case Ifc4.Interfaces.IfcTransportElementTypeEnum.USERDEFINED:
						PredefinedType = IfcTransportElementTypeEnum.USERDEFINED;
						return;
					case Ifc4.Interfaces.IfcTransportElementTypeEnum.NOTDEFINED:
						PredefinedType = IfcTransportElementTypeEnum.NOTDEFINED;
						return;
					default:
						throw new System.ArgumentOutOfRangeException();
				}
				
			}
		}
	//## Custom code
	//##
	}
}