// ------------------------------------------------------------------------------
// <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.Kernel
{
	public partial class @IfcComplexPropertyTemplate : IIfcComplexPropertyTemplate
	{

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

		[CrossSchemaAttribute(typeof(IIfcComplexPropertyTemplate), 6)]
		Ifc4.Interfaces.IfcComplexPropertyTemplateTypeEnum? IIfcComplexPropertyTemplate.TemplateType 
		{ 
			get
			{
				//## Custom code to handle enumeration of TemplateType
				//##
				switch (TemplateType)
				{
					case IfcComplexPropertyTemplateTypeEnum.P_COMPLEX:
						return Ifc4.Interfaces.IfcComplexPropertyTemplateTypeEnum.P_COMPLEX;
					case IfcComplexPropertyTemplateTypeEnum.Q_COMPLEX:
						return Ifc4.Interfaces.IfcComplexPropertyTemplateTypeEnum.Q_COMPLEX;
					case null: 
						return null;
					
					default:
						throw new System.ArgumentOutOfRangeException();
				}
			} 
			set
			{
				//## Custom code to handle setting of enumeration of TemplateType
				//##
				switch (value)
				{
					case Ifc4.Interfaces.IfcComplexPropertyTemplateTypeEnum.P_COMPLEX:
						TemplateType = IfcComplexPropertyTemplateTypeEnum.P_COMPLEX;
						return;
					case Ifc4.Interfaces.IfcComplexPropertyTemplateTypeEnum.Q_COMPLEX:
						TemplateType = IfcComplexPropertyTemplateTypeEnum.Q_COMPLEX;
						return;
					
					case null:
						TemplateType = null;
						return;
					default:
						throw new System.ArgumentOutOfRangeException();
				}
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcComplexPropertyTemplate), 7)]
		IItemSet<IIfcPropertyTemplate> IIfcComplexPropertyTemplate.HasPropertyTemplates 
		{ 
			get
			{
			
				return new Common.Collections.ProxyItemSet<IfcPropertyTemplate, IIfcPropertyTemplate>(HasPropertyTemplates);
			} 
		}
	//## Custom code
	//##
	}
}