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


namespace Xbim.Ifc2x3.DateTimeResource
{
	[ExpressType("IfcCoordinatedUniversalTimeOffset", 690)]
	// ReSharper disable once PartialTypeWithSinglePart
	public  partial class @IfcCoordinatedUniversalTimeOffset : PersistEntity, IInstantiableEntity, IEquatable<@IfcCoordinatedUniversalTimeOffset>
	{

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

		#region Explicit attribute fields
		private IfcHourInDay _hourOffset;
		private IfcMinuteInHour? _minuteOffset;
		private IfcAheadOrBehind _sense;
		#endregion
	
		#region Explicit attribute properties
		[EntityAttribute(1, EntityAttributeState.Mandatory, EntityAttributeType.None, EntityAttributeType.None, null, null, 1)]
		public IfcHourInDay @HourOffset 
		{ 
			get 
			{
				if(_activated) return _hourOffset;
				Activate();
				return _hourOffset;
			} 
			set
			{
				SetValue( v =>  _hourOffset = v, _hourOffset, value,  "HourOffset", 1);
			} 
		}	
		[EntityAttribute(2, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 2)]
		public IfcMinuteInHour? @MinuteOffset 
		{ 
			get 
			{
				if(_activated) return _minuteOffset;
				Activate();
				return _minuteOffset;
			} 
			set
			{
				SetValue( v =>  _minuteOffset = v, _minuteOffset, value,  "MinuteOffset", 2);
			} 
		}	
		[EntityAttribute(3, EntityAttributeState.Mandatory, EntityAttributeType.Enum, EntityAttributeType.None, null, null, 3)]
		public IfcAheadOrBehind @Sense 
		{ 
			get 
			{
				if(_activated) return _sense;
				Activate();
				return _sense;
			} 
			set
			{
				SetValue( v =>  _sense = v, _sense, value,  "Sense", 3);
			} 
		}	
		#endregion




		#region IPersist implementation
		public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
		{
			switch (propIndex)
			{
				case 0: 
					_hourOffset = value.IntegerVal;
					return;
				case 1: 
					_minuteOffset = value.IntegerVal;
					return;
				case 2: 
                    _sense = (IfcAheadOrBehind) System.Enum.Parse(typeof (IfcAheadOrBehind), 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(@IfcCoordinatedUniversalTimeOffset other)
	    {
	        return this == other;
	    }
        #endregion

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