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


namespace Xbim.Ifc2x3.SharedBldgServiceElements
{
	[ExpressType("IfcElectricalBaseProperties", 177)]
	// ReSharper disable once PartialTypeWithSinglePart
	public  partial class @IfcElectricalBaseProperties : IfcEnergyProperties, IInstantiableEntity, IContainsEntityReferences, IEquatable<@IfcElectricalBaseProperties>
	{

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

		#region Explicit attribute fields
		private IfcElectricCurrentEnum? _electricCurrentType;
		private IfcElectricVoltageMeasure _inputVoltage;
		private IfcFrequencyMeasure _inputFrequency;
		private IfcElectricCurrentMeasure? _fullLoadCurrent;
		private IfcElectricCurrentMeasure? _minimumCircuitCurrent;
		private IfcPowerMeasure? _maximumPowerInput;
		private IfcPowerMeasure? _ratedPowerInput;
		private long _inputPhase;
		#endregion
	
		#region Explicit attribute properties
		[EntityAttribute(7, EntityAttributeState.Optional, EntityAttributeType.Enum, EntityAttributeType.None, null, null, 10)]
		public IfcElectricCurrentEnum? @ElectricCurrentType 
		{ 
			get 
			{
				if(_activated) return _electricCurrentType;
				Activate();
				return _electricCurrentType;
			} 
			set
			{
				SetValue( v =>  _electricCurrentType = v, _electricCurrentType, value,  "ElectricCurrentType", 7);
			} 
		}	
		[EntityAttribute(8, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 11)]
		public IfcElectricVoltageMeasure @InputVoltage 
		{ 
			get 
			{
				if(_activated) return _inputVoltage;
				Activate();
				return _inputVoltage;
			} 
			set
			{
				SetValue( v =>  _inputVoltage = v, _inputVoltage, value,  "InputVoltage", 8);
			} 
		}	
		[EntityAttribute(9, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 12)]
		public IfcFrequencyMeasure @InputFrequency 
		{ 
			get 
			{
				if(_activated) return _inputFrequency;
				Activate();
				return _inputFrequency;
			} 
			set
			{
				SetValue( v =>  _inputFrequency = v, _inputFrequency, value,  "InputFrequency", 9);
			} 
		}	
		[EntityAttribute(10, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 13)]
		public IfcElectricCurrentMeasure? @FullLoadCurrent 
		{ 
			get 
			{
				if(_activated) return _fullLoadCurrent;
				Activate();
				return _fullLoadCurrent;
			} 
			set
			{
				SetValue( v =>  _fullLoadCurrent = v, _fullLoadCurrent, value,  "FullLoadCurrent", 10);
			} 
		}	
		[EntityAttribute(11, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 14)]
		public IfcElectricCurrentMeasure? @MinimumCircuitCurrent 
		{ 
			get 
			{
				if(_activated) return _minimumCircuitCurrent;
				Activate();
				return _minimumCircuitCurrent;
			} 
			set
			{
				SetValue( v =>  _minimumCircuitCurrent = v, _minimumCircuitCurrent, value,  "MinimumCircuitCurrent", 11);
			} 
		}	
		[EntityAttribute(12, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 15)]
		public IfcPowerMeasure? @MaximumPowerInput 
		{ 
			get 
			{
				if(_activated) return _maximumPowerInput;
				Activate();
				return _maximumPowerInput;
			} 
			set
			{
				SetValue( v =>  _maximumPowerInput = v, _maximumPowerInput, value,  "MaximumPowerInput", 12);
			} 
		}	
		[EntityAttribute(13, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 16)]
		public IfcPowerMeasure? @RatedPowerInput 
		{ 
			get 
			{
				if(_activated) return _ratedPowerInput;
				Activate();
				return _ratedPowerInput;
			} 
			set
			{
				SetValue( v =>  _ratedPowerInput = v, _ratedPowerInput, value,  "RatedPowerInput", 13);
			} 
		}	
		[EntityAttribute(14, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 17)]
		public long @InputPhase 
		{ 
			get 
			{
				if(_activated) return _inputPhase;
				Activate();
				return _inputPhase;
			} 
			set
			{
				SetValue( v =>  _inputPhase = v, _inputPhase, value,  "InputPhase", 14);
			} 
		}	
		#endregion




		#region IPersist implementation
		public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
		{
			switch (propIndex)
			{
				case 0: 
				case 1: 
				case 2: 
				case 3: 
				case 4: 
				case 5: 
					base.Parse(propIndex, value, nestedIndex); 
					return;
				case 6: 
                    _electricCurrentType = (IfcElectricCurrentEnum) System.Enum.Parse(typeof (IfcElectricCurrentEnum), value.EnumVal, true);
					return;
				case 7: 
					_inputVoltage = value.RealVal;
					return;
				case 8: 
					_inputFrequency = value.RealVal;
					return;
				case 9: 
					_fullLoadCurrent = value.RealVal;
					return;
				case 10: 
					_minimumCircuitCurrent = value.RealVal;
					return;
				case 11: 
					_maximumPowerInput = value.RealVal;
					return;
				case 12: 
					_ratedPowerInput = value.RealVal;
					return;
				case 13: 
					_inputPhase = value.IntegerVal;
					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(@IfcElectricalBaseProperties other)
	    {
	        return this == other;
	    }
        #endregion

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

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