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

namespace Xbim.Ifc4.Interfaces
{
	/// <summary>
    /// Readonly interface for IfcTransitionCurveSegment2D
    /// </summary>
	// ReSharper disable once PartialTypeWithSinglePart
	public partial interface @IIfcTransitionCurveSegment2D : IIfcCurveSegment2D
	{
		IfcPositiveLengthMeasure? @StartRadius { get;  set; }
		IfcPositiveLengthMeasure? @EndRadius { get;  set; }
		IfcBoolean @IsStartRadiusCCW { get;  set; }
		IfcBoolean @IsEndRadiusCCW { get;  set; }
		IfcTransitionCurveType @TransitionCurveType { get;  set; }
	
	}
}

namespace Xbim.Ifc4.GeometryResource
{
	[ExpressType("IfcTransitionCurveSegment2D", 1356)]
	// ReSharper disable once PartialTypeWithSinglePart
	public  partial class @IfcTransitionCurveSegment2D : IfcCurveSegment2D, IInstantiableEntity, IIfcTransitionCurveSegment2D, IContainsEntityReferences, IEquatable<@IfcTransitionCurveSegment2D>
	{
		#region IIfcTransitionCurveSegment2D explicit implementation
		IfcPositiveLengthMeasure? IIfcTransitionCurveSegment2D.StartRadius { 
 
			get { return @StartRadius; } 
			set { StartRadius = value;}
		}	
		IfcPositiveLengthMeasure? IIfcTransitionCurveSegment2D.EndRadius { 
 
			get { return @EndRadius; } 
			set { EndRadius = value;}
		}	
		IfcBoolean IIfcTransitionCurveSegment2D.IsStartRadiusCCW { 
 
			get { return @IsStartRadiusCCW; } 
			set { IsStartRadiusCCW = value;}
		}	
		IfcBoolean IIfcTransitionCurveSegment2D.IsEndRadiusCCW { 
 
			get { return @IsEndRadiusCCW; } 
			set { IsEndRadiusCCW = value;}
		}	
		IfcTransitionCurveType IIfcTransitionCurveSegment2D.TransitionCurveType { 
 
			get { return @TransitionCurveType; } 
			set { TransitionCurveType = value;}
		}	
		#endregion

		//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area
		internal IfcTransitionCurveSegment2D(IModel model, int label, bool activated) : base(model, label, activated)  
		{
		}

		#region Explicit attribute fields
		private IfcPositiveLengthMeasure? _startRadius;
		private IfcPositiveLengthMeasure? _endRadius;
		private IfcBoolean _isStartRadiusCCW;
		private IfcBoolean _isEndRadiusCCW;
		private IfcTransitionCurveType _transitionCurveType;
		#endregion
	
		#region Explicit attribute properties
		[EntityAttribute(4, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 6)]
		public IfcPositiveLengthMeasure? @StartRadius 
		{ 
			get 
			{
				if(_activated) return _startRadius;
				Activate();
				return _startRadius;
			} 
			set
			{
				SetValue( v =>  _startRadius = v, _startRadius, value,  "StartRadius", 4);
			} 
		}	
		[EntityAttribute(5, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 7)]
		public IfcPositiveLengthMeasure? @EndRadius 
		{ 
			get 
			{
				if(_activated) return _endRadius;
				Activate();
				return _endRadius;
			} 
			set
			{
				SetValue( v =>  _endRadius = v, _endRadius, value,  "EndRadius", 5);
			} 
		}	
		[EntityAttribute(6, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 8)]
		public IfcBoolean @IsStartRadiusCCW 
		{ 
			get 
			{
				if(_activated) return _isStartRadiusCCW;
				Activate();
				return _isStartRadiusCCW;
			} 
			set
			{
				SetValue( v =>  _isStartRadiusCCW = v, _isStartRadiusCCW, value,  "IsStartRadiusCCW", 6);
			} 
		}	
		[EntityAttribute(7, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 9)]
		public IfcBoolean @IsEndRadiusCCW 
		{ 
			get 
			{
				if(_activated) return _isEndRadiusCCW;
				Activate();
				return _isEndRadiusCCW;
			} 
			set
			{
				SetValue( v =>  _isEndRadiusCCW = v, _isEndRadiusCCW, value,  "IsEndRadiusCCW", 7);
			} 
		}	
		[EntityAttribute(8, EntityAttributeState.Mandatory, EntityAttributeType.Enum, EntityAttributeType.None, null, null, 10)]
		public IfcTransitionCurveType @TransitionCurveType 
		{ 
			get 
			{
				if(_activated) return _transitionCurveType;
				Activate();
				return _transitionCurveType;
			} 
			set
			{
				SetValue( v =>  _transitionCurveType = v, _transitionCurveType, value,  "TransitionCurveType", 8);
			} 
		}	
		#endregion




		#region IPersist implementation
		public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
		{
			switch (propIndex)
			{
				case 0: 
				case 1: 
				case 2: 
					base.Parse(propIndex, value, nestedIndex); 
					return;
				case 3: 
					_startRadius = value.RealVal;
					return;
				case 4: 
					_endRadius = value.RealVal;
					return;
				case 5: 
					_isStartRadiusCCW = value.BooleanVal;
					return;
				case 6: 
					_isEndRadiusCCW = value.BooleanVal;
					return;
				case 7: 
                    _transitionCurveType = (IfcTransitionCurveType) System.Enum.Parse(typeof (IfcTransitionCurveType), value.EnumVal, true);
					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(@IfcTransitionCurveSegment2D other)
	    {
	        return this == other;
	    }
        #endregion

		#region IContainsEntityReferences
		IEnumerable<IPersistEntity> IContainsEntityReferences.References 
		{
			get 
			{
				if (@StartPoint != null)
					yield return @StartPoint;
			}
		}
		#endregion

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