// ------------------------------------------------------------------------------
// <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.MeasureResource;
using Xbim.Ifc4.DateTimeResource;
using Xbim.Ifc4.Kernel;
using System;
using System.Collections.Generic;
using System.Linq;
using Xbim.Common;
using Xbim.Common.Exceptions;
using Xbim.Ifc4.Interfaces;
using Xbim.Ifc4.ExternalReferenceResource;
//## Custom using statements
//##

namespace Xbim.Ifc4.Interfaces
{
	/// <summary>
    /// Readonly interface for IfcClassification
    /// </summary>
	// ReSharper disable once PartialTypeWithSinglePart
	public partial interface @IIfcClassification : IIfcExternalInformation, IfcClassificationReferenceSelect, IfcClassificationSelect
	{
		IfcLabel? @Source { get;  set; }
		IfcLabel? @Edition { get;  set; }
		IfcDate? @EditionDate { get;  set; }
		IfcLabel @Name { get;  set; }
		IfcText? @Description { get;  set; }
		IfcURIReference? @Location { get;  set; }
		IItemSet<IfcIdentifier> @ReferenceTokens { get; }
		IEnumerable<IIfcRelAssociatesClassification> @ClassificationForObjects {  get; }
		IEnumerable<IIfcClassificationReference> @HasReferences {  get; }
	
	}
}

namespace Xbim.Ifc4.ExternalReferenceResource
{
	[ExpressType("IfcClassification", 412)]
	// ReSharper disable once PartialTypeWithSinglePart
	public  partial class @IfcClassification : IfcExternalInformation, IInstantiableEntity, IIfcClassification, IEquatable<@IfcClassification>
	{
		#region IIfcClassification explicit implementation
		IfcLabel? IIfcClassification.Source { 
 
			get { return @Source; } 
			set { Source = value;}
		}	
		IfcLabel? IIfcClassification.Edition { 
 
			get { return @Edition; } 
			set { Edition = value;}
		}	
		IfcDate? IIfcClassification.EditionDate { 
 
			get { return @EditionDate; } 
			set { EditionDate = value;}
		}	
		IfcLabel IIfcClassification.Name { 
 
			get { return @Name; } 
			set { Name = value;}
		}	
		IfcText? IIfcClassification.Description { 
 
			get { return @Description; } 
			set { Description = value;}
		}	
		IfcURIReference? IIfcClassification.Location { 
 
			get { return @Location; } 
			set { Location = value;}
		}	
		IItemSet<IfcIdentifier> IIfcClassification.ReferenceTokens { 
			get { return @ReferenceTokens; } 
		}	
		IEnumerable<IIfcRelAssociatesClassification> IIfcClassification.ClassificationForObjects {  get { return @ClassificationForObjects; } }
		IEnumerable<IIfcClassificationReference> IIfcClassification.HasReferences {  get { return @HasReferences; } }
		#endregion

		//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area
		internal IfcClassification(IModel model, int label, bool activated) : base(model, label, activated)  
		{
			_referenceTokens = new OptionalItemSet<IfcIdentifier>( this, 0,  7);
		}

		#region Explicit attribute fields
		private IfcLabel? _source;
		private IfcLabel? _edition;
		private IfcDate? _editionDate;
		private IfcLabel _name;
		private IfcText? _description;
		private IfcURIReference? _location;
		private readonly OptionalItemSet<IfcIdentifier> _referenceTokens;
		#endregion
	
		#region Explicit attribute properties
		[EntityAttribute(1, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 1)]
		public IfcLabel? @Source 
		{ 
			get 
			{
				if(_activated) return _source;
				Activate();
				return _source;
			} 
			set
			{
				SetValue( v =>  _source = v, _source, value,  "Source", 1);
			} 
		}	
		[EntityAttribute(2, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 2)]
		public IfcLabel? @Edition 
		{ 
			get 
			{
				if(_activated) return _edition;
				Activate();
				return _edition;
			} 
			set
			{
				SetValue( v =>  _edition = v, _edition, value,  "Edition", 2);
			} 
		}	
		[EntityAttribute(3, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 3)]
		public IfcDate? @EditionDate 
		{ 
			get 
			{
				if(_activated) return _editionDate;
				Activate();
				return _editionDate;
			} 
			set
			{
				SetValue( v =>  _editionDate = v, _editionDate, value,  "EditionDate", 3);
			} 
		}	
		[EntityAttribute(4, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 4)]
		public IfcLabel @Name 
		{ 
			get 
			{
				if(_activated) return _name;
				Activate();
				return _name;
			} 
			set
			{
				SetValue( v =>  _name = v, _name, value,  "Name", 4);
			} 
		}	
		[EntityAttribute(5, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 5)]
		public IfcText? @Description 
		{ 
			get 
			{
				if(_activated) return _description;
				Activate();
				return _description;
			} 
			set
			{
				SetValue( v =>  _description = v, _description, value,  "Description", 5);
			} 
		}	
		[EntityAttribute(6, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 6)]
		public IfcURIReference? @Location 
		{ 
			get 
			{
				if(_activated) return _location;
				Activate();
				return _location;
			} 
			set
			{
				SetValue( v =>  _location = v, _location, value,  "Location", 6);
			} 
		}	
		[EntityAttribute(7, EntityAttributeState.Optional, EntityAttributeType.List, EntityAttributeType.None, new int [] { 1 }, new int [] { -1 }, 7)]
		public IOptionalItemSet<IfcIdentifier> @ReferenceTokens 
		{ 
			get 
			{
				if(_activated) return _referenceTokens;
				Activate();
				return _referenceTokens;
			} 
		}	
		#endregion



		#region Inverse attributes
		[InverseProperty("RelatingClassification")]
		[EntityAttribute(-1, EntityAttributeState.Mandatory, EntityAttributeType.Set, EntityAttributeType.Class, new int [] { 0 }, new int [] { -1 }, 8)]
		public IEnumerable<IfcRelAssociatesClassification> @ClassificationForObjects 
		{ 
			get 
			{
				return Model.Instances.Where<IfcRelAssociatesClassification>(e => Equals(e.RelatingClassification), "RelatingClassification", this);
			} 
		}
		[InverseProperty("ReferencedSource")]
		[EntityAttribute(-1, EntityAttributeState.Mandatory, EntityAttributeType.Set, EntityAttributeType.Class, new int [] { 0 }, new int [] { -1 }, 9)]
		public IEnumerable<IfcClassificationReference> @HasReferences 
		{ 
			get 
			{
				return Model.Instances.Where<IfcClassificationReference>(e => Equals(e.ReferencedSource), "ReferencedSource", this);
			} 
		}
		#endregion

		#region IPersist implementation
		public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
		{
			switch (propIndex)
			{
				case 0: 
					_source = value.StringVal;
					return;
				case 1: 
					_edition = value.StringVal;
					return;
				case 2: 
					_editionDate = value.StringVal;
					return;
				case 3: 
					_name = value.StringVal;
					return;
				case 4: 
					_description = value.StringVal;
					return;
				case 5: 
					_location = value.StringVal;
					return;
				case 6: 
					_referenceTokens.InternalAdd(value.StringVal);
					return;
				default:
					throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
			}
		}
		#endregion

		#region Equality comparers and operators
        public bool Equals(@IfcClassification other)
	    {
	        return this == other;
	    }
        #endregion

		#region Custom code (will survive code regeneration)
		//## Custom code
		//##
		#endregion
	}
}