// ------------------------------------------------------------------------------
// <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.ApprovalResource
{
	public partial class @IfcApprovalRelationship : IIfcApprovalRelationship
	{

		[CrossSchemaAttribute(typeof(IIfcApprovalRelationship), 3)]
		IIfcApproval IIfcApprovalRelationship.RelatingApproval 
		{ 
			get
			{
				return RelatingApproval;
			} 
			set
			{
				RelatingApproval = value as IfcApproval;
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcApprovalRelationship), 4)]
		IItemSet<IIfcApproval> IIfcApprovalRelationship.RelatedApprovals 
		{ 
			get
			{
				//## Handle return of RelatedApprovals for which no match was found
                return _relatedApprovals ?? (_relatedApprovals =  new Common.Collections.ExtendedSingleSet<IfcApproval, IIfcApproval>(
                    () => RelatedApproval, 
                    approval => RelatedApproval = approval,
                    new ItemSet<IIfcApproval>(this, 0, -4),
                    s => s,
                    t => t as IfcApproval
                    ));
				//##
			} 
		}

		[CrossSchemaAttribute(typeof(IIfcApprovalRelationship), 1)]
		Ifc4.MeasureResource.IfcLabel? IIfcResourceLevelRelationship.Name 
		{ 
			get
			{
				return new Ifc4.MeasureResource.IfcLabel(Name);
			} 
			set
			{
				Name = value.HasValue ? 
					new MeasureResource.IfcLabel(value.Value) :  
					 default(MeasureResource.IfcLabel) ;
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcApprovalRelationship), 2)]
		Ifc4.MeasureResource.IfcText? IIfcResourceLevelRelationship.Description 
		{ 
			get
			{
				if (!Description.HasValue) return null;
				return new Ifc4.MeasureResource.IfcText(Description.Value);
			} 
			set
			{
				Description = value.HasValue ? 
					new MeasureResource.IfcText(value.Value) :  
					 new MeasureResource.IfcText?() ;
				
			}
		}
	//## Custom code
	    private IItemSet<IIfcApproval> _relatedApprovals;
	    //##
	}
}