// ------------------------------------------------------------------------------
// <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 @IfcTypeObject : IIfcTypeObject
	{

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

		[CrossSchemaAttribute(typeof(IIfcTypeObject), 6)]
		IItemSet<IIfcPropertySetDefinition> IIfcTypeObject.HasPropertySets 
		{ 
			get
			{
			
				return new Common.Collections.ProxyItemSet<IfcPropertySetDefinition, IIfcPropertySetDefinition>(HasPropertySets);
			} 
		}
		IEnumerable<IIfcRelDefinesByType> IIfcTypeObject.Types 
		{ 
			get
			{
				return Model.Instances.Where<IIfcRelDefinesByType>(e => (e.RelatingType as IfcTypeObject) == this, "RelatingType", this);
			} 
		}
	//## Custom code
		IEnumerable<IIfcRelDefinesByProperties> IIfcTypeObject.DefinedByProperties
		{
			get
			{
				return Model.Instances.Where<IfcRelDefinesByProperties>(e => e.RelatedObjects.Contains(this), "RelatedObjects", this);
			}
		}
		//##
	}
}