// ------------------------------------------------------------------------------
// <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.Ifc4x3.MeasureResource;
using System;
using System.Collections.Generic;
using System.Linq;
using Xbim.Common;
using Xbim.Common.Exceptions;
using Xbim.Ifc4x3.GeometricConstraintResource;
//## Custom using statements
//##


namespace Xbim.Ifc4x3.GeometricConstraintResource
{
	[ExpressType("IfcAlignmentVerticalSegment", 1409)]
	// ReSharper disable once PartialTypeWithSinglePart
	public  partial class @IfcAlignmentVerticalSegment : IfcAlignmentParameterSegment, IInstantiableEntity, IEquatable<@IfcAlignmentVerticalSegment>
	{

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

		#region Explicit attribute fields
		private IfcLengthMeasure _startDistAlong;
		private IfcNonNegativeLengthMeasure _horizontalLength;
		private IfcLengthMeasure _startHeight;
		private IfcRatioMeasure _startGradient;
		private IfcRatioMeasure _endGradient;
		private IfcLengthMeasure? _radiusOfCurvature;
		private IfcAlignmentVerticalSegmentTypeEnum _predefinedType;
		#endregion
	
		#region Explicit attribute properties
		[EntityAttribute(3, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 3)]
		public IfcLengthMeasure @StartDistAlong 
		{ 
			get 
			{
				if(_activated) return _startDistAlong;
				Activate();
				return _startDistAlong;
			} 
			set
			{
				SetValue( v =>  _startDistAlong = v, _startDistAlong, value,  "StartDistAlong", 3);
			} 
		}	
		[EntityAttribute(4, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 4)]
		public IfcNonNegativeLengthMeasure @HorizontalLength 
		{ 
			get 
			{
				if(_activated) return _horizontalLength;
				Activate();
				return _horizontalLength;
			} 
			set
			{
				SetValue( v =>  _horizontalLength = v, _horizontalLength, value,  "HorizontalLength", 4);
			} 
		}	
		[EntityAttribute(5, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 5)]
		public IfcLengthMeasure @StartHeight 
		{ 
			get 
			{
				if(_activated) return _startHeight;
				Activate();
				return _startHeight;
			} 
			set
			{
				SetValue( v =>  _startHeight = v, _startHeight, value,  "StartHeight", 5);
			} 
		}	
		[EntityAttribute(6, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 6)]
		public IfcRatioMeasure @StartGradient 
		{ 
			get 
			{
				if(_activated) return _startGradient;
				Activate();
				return _startGradient;
			} 
			set
			{
				SetValue( v =>  _startGradient = v, _startGradient, value,  "StartGradient", 6);
			} 
		}	
		[EntityAttribute(7, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 7)]
		public IfcRatioMeasure @EndGradient 
		{ 
			get 
			{
				if(_activated) return _endGradient;
				Activate();
				return _endGradient;
			} 
			set
			{
				SetValue( v =>  _endGradient = v, _endGradient, value,  "EndGradient", 7);
			} 
		}	
		[EntityAttribute(8, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 8)]
		public IfcLengthMeasure? @RadiusOfCurvature 
		{ 
			get 
			{
				if(_activated) return _radiusOfCurvature;
				Activate();
				return _radiusOfCurvature;
			} 
			set
			{
				SetValue( v =>  _radiusOfCurvature = v, _radiusOfCurvature, value,  "RadiusOfCurvature", 8);
			} 
		}	
		[EntityAttribute(9, EntityAttributeState.Mandatory, EntityAttributeType.Enum, EntityAttributeType.None, null, null, 9)]
		public IfcAlignmentVerticalSegmentTypeEnum @PredefinedType 
		{ 
			get 
			{
				if(_activated) return _predefinedType;
				Activate();
				return _predefinedType;
			} 
			set
			{
				SetValue( v =>  _predefinedType = v, _predefinedType, value,  "PredefinedType", 9);
			} 
		}	
		#endregion




		#region IPersist implementation
		public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
		{
			switch (propIndex)
			{
				case 0: 
				case 1: 
					base.Parse(propIndex, value, nestedIndex); 
					return;
				case 2: 
					_startDistAlong = value.RealVal;
					return;
				case 3: 
					_horizontalLength = value.RealVal;
					return;
				case 4: 
					_startHeight = value.RealVal;
					return;
				case 5: 
					_startGradient = value.RealVal;
					return;
				case 6: 
					_endGradient = value.RealVal;
					return;
				case 7: 
					_radiusOfCurvature = value.RealVal;
					return;
				case 8: 
                    _predefinedType = (IfcAlignmentVerticalSegmentTypeEnum) System.Enum.Parse(typeof (IfcAlignmentVerticalSegmentTypeEnum), 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(@IfcAlignmentVerticalSegment other)
	    {
	        return this == other;
	    }
        #endregion

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