// ------------------------------------------------------------------------------
// <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.MaterialResource
{
	public partial class @IfcMaterialConstituent : IIfcMaterialConstituent
	{

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

		[CrossSchemaAttribute(typeof(IIfcMaterialConstituent), 2)]
		Ifc4.MeasureResource.IfcText? IIfcMaterialConstituent.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?() ;
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcMaterialConstituent), 3)]
		IIfcMaterial IIfcMaterialConstituent.Material 
		{ 
			get
			{
				return Material;
			} 
			set
			{
				Material = value as IfcMaterial;
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcMaterialConstituent), 4)]
		Ifc4.MeasureResource.IfcNormalisedRatioMeasure? IIfcMaterialConstituent.Fraction 
		{ 
			get
			{
				if (!Fraction.HasValue) return null;
				return new Ifc4.MeasureResource.IfcNormalisedRatioMeasure(Fraction.Value);
			} 
			set
			{
				Fraction = value.HasValue ? 
					new MeasureResource.IfcNormalisedRatioMeasure(value.Value) :  
					 new MeasureResource.IfcNormalisedRatioMeasure?() ;
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcMaterialConstituent), 5)]
		Ifc4.MeasureResource.IfcLabel? IIfcMaterialConstituent.Category 
		{ 
			get
			{
				if (!Category.HasValue) return null;
				return new Ifc4.MeasureResource.IfcLabel(Category.Value);
			} 
			set
			{
				Category = value.HasValue ? 
					new MeasureResource.IfcLabel(value.Value) :  
					 new MeasureResource.IfcLabel?() ;
				
			}
		}
		IIfcMaterialConstituentSet IIfcMaterialConstituent.ToMaterialConstituentSet 
		{ 
			get
			{
				return Model.Instances.FirstOrDefault<IIfcMaterialConstituentSet>(e => e.MaterialConstituents != null &&  e.MaterialConstituents.Contains(this), "MaterialConstituents", this);
			} 
		}
	//## Custom code
	//##
	}
}