// ------------------------------------------------------------------------------
// <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.SharedBldgElements
{
	public partial class @IfcRoof : IIfcRoof
	{

		[CrossSchemaAttribute(typeof(IIfcRoof), 9)]
		Ifc4.Interfaces.IfcRoofTypeEnum? IIfcRoof.PredefinedType 
		{ 
			get
			{
				//## Custom code to handle enumeration of PredefinedType
			    if (ObjectType.HasValue)
			    {
                    Ifc4.Interfaces.IfcRoofTypeEnum result;
                    if (System.Enum.TryParse(ObjectType.Value, false, out result))
                        return result;
			    }
				//##
				switch (ShapeType)
				{
					case IfcRoofTypeEnum.FLAT_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.FLAT_ROOF;
					case IfcRoofTypeEnum.SHED_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.SHED_ROOF;
					case IfcRoofTypeEnum.GABLE_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.GABLE_ROOF;
					case IfcRoofTypeEnum.HIP_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.HIP_ROOF;
					case IfcRoofTypeEnum.HIPPED_GABLE_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.HIPPED_GABLE_ROOF;
					case IfcRoofTypeEnum.GAMBREL_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.GAMBREL_ROOF;
					case IfcRoofTypeEnum.MANSARD_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.MANSARD_ROOF;
					case IfcRoofTypeEnum.BARREL_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.BARREL_ROOF;
					case IfcRoofTypeEnum.RAINBOW_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.RAINBOW_ROOF;
					case IfcRoofTypeEnum.BUTTERFLY_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.BUTTERFLY_ROOF;
					case IfcRoofTypeEnum.PAVILION_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.PAVILION_ROOF;
					case IfcRoofTypeEnum.DOME_ROOF:
						return Ifc4.Interfaces.IfcRoofTypeEnum.DOME_ROOF;
					case IfcRoofTypeEnum.FREEFORM:
						return Ifc4.Interfaces.IfcRoofTypeEnum.FREEFORM;
					case IfcRoofTypeEnum.NOTDEFINED:
						return Ifc4.Interfaces.IfcRoofTypeEnum.NOTDEFINED;
					
					default:
						throw new System.ArgumentOutOfRangeException();
				}
			} 
			set
			{
				//## Custom code to handle setting of enumeration of PredefinedType
				//##
				switch (value)
				{
					case Ifc4.Interfaces.IfcRoofTypeEnum.FLAT_ROOF:
						ShapeType = IfcRoofTypeEnum.FLAT_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.SHED_ROOF:
						ShapeType = IfcRoofTypeEnum.SHED_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.GABLE_ROOF:
						ShapeType = IfcRoofTypeEnum.GABLE_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.HIP_ROOF:
						ShapeType = IfcRoofTypeEnum.HIP_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.HIPPED_GABLE_ROOF:
						ShapeType = IfcRoofTypeEnum.HIPPED_GABLE_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.GAMBREL_ROOF:
						ShapeType = IfcRoofTypeEnum.GAMBREL_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.MANSARD_ROOF:
						ShapeType = IfcRoofTypeEnum.MANSARD_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.BARREL_ROOF:
						ShapeType = IfcRoofTypeEnum.BARREL_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.RAINBOW_ROOF:
						ShapeType = IfcRoofTypeEnum.RAINBOW_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.BUTTERFLY_ROOF:
						ShapeType = IfcRoofTypeEnum.BUTTERFLY_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.PAVILION_ROOF:
						ShapeType = IfcRoofTypeEnum.PAVILION_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.DOME_ROOF:
						ShapeType = IfcRoofTypeEnum.DOME_ROOF;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.FREEFORM:
						ShapeType = IfcRoofTypeEnum.FREEFORM;
						return;
					case Ifc4.Interfaces.IfcRoofTypeEnum.USERDEFINED:
						//## Handle setting of USERDEFINED member from IfcRoofTypeEnum in property PredefinedType
						ObjectType = value.ToString();
                        ShapeType = IfcRoofTypeEnum.NOTDEFINED;
				        return;
						//##
										case Ifc4.Interfaces.IfcRoofTypeEnum.NOTDEFINED:
						ShapeType = IfcRoofTypeEnum.NOTDEFINED;
						return;
					case null:
						ShapeType = IfcRoofTypeEnum.NOTDEFINED;
						return;
					default:
						throw new System.ArgumentOutOfRangeException();
				}
				
			}
		}
	//## Custom code
	//##
	}
}