// ------------------------------------------------------------------------------
// <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.PropertyResource
{
	public partial class @IfcPropertyEnumeration : IIfcPropertyEnumeration
	{

		[CrossSchemaAttribute(typeof(IIfcPropertyEnumeration), 1)]
		Ifc4.MeasureResource.IfcLabel IIfcPropertyEnumeration.Name 
		{ 
			get
			{
				return new Ifc4.MeasureResource.IfcLabel(Name);
			} 
			set
			{
				Name = new MeasureResource.IfcLabel(value);
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcPropertyEnumeration), 2)]
		IItemSet<IIfcValue> IIfcPropertyEnumeration.EnumerationValues 
		{ 
			get
			{
			
				return _enumerationValuesIfc4 ?? (_enumerationValuesIfc4 = new Common.Collections.ExtendedItemSet<MeasureResource.IfcValue, IIfcValue>(
                    EnumerationValues, 
                    new ItemSet<IIfcValue>(this, 0, -2), 
                    v => v.ToIfc4(), 
                    v => v.ToIfc3()));
			} 
		}

		//private field to hold any extended data
		private IItemSet<IIfcValue> _enumerationValuesIfc4;

		[CrossSchemaAttribute(typeof(IIfcPropertyEnumeration), 3)]
		IIfcUnit IIfcPropertyEnumeration.Unit 
		{ 
			get
			{
				if (Unit == null) return null;
				var ifcderivedunit = Unit as MeasureResource.IfcDerivedUnit;
				if (ifcderivedunit != null) 
					return ifcderivedunit;
				var ifcmonetaryunit = Unit as MeasureResource.IfcMonetaryUnit;
				if (ifcmonetaryunit != null) 
					return ifcmonetaryunit;
				var ifcnamedunit = Unit as MeasureResource.IfcNamedUnit;
				if (ifcnamedunit != null) 
					return ifcnamedunit;
				return null;
			} 
			set
			{
				if (value == null)
				{
					Unit = null;
					return;
				}	
				var ifcderivedunit = value as MeasureResource.IfcDerivedUnit;
				if (ifcderivedunit != null) 
				{
					Unit = ifcderivedunit;
					return;
				}
				var ifcmonetaryunit = value as MeasureResource.IfcMonetaryUnit;
				if (ifcmonetaryunit != null) 
				{
					Unit = ifcmonetaryunit;
					return;
				}
				var ifcnamedunit = value as MeasureResource.IfcNamedUnit;
				if (ifcnamedunit != null) 
				{
					Unit = ifcnamedunit;
					return;
				}
				
			}
		}
	//## Custom code
	//##
	}
}