// ------------------------------------------------------------------------------
// <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 Xbim.Common;
using Xbim.Common.Exceptions;
using Xbim.Ifc4.Interfaces;
using Xbim.Ifc4.DateTimeResource;
//## Custom using statements
//##

namespace Xbim.Ifc4.Interfaces
{
	/// <summary>
    /// Readonly interface for IfcEventTime
    /// </summary>
	// ReSharper disable once PartialTypeWithSinglePart
	public partial interface @IIfcEventTime : IIfcSchedulingTime
	{
		IfcDateTime? @ActualDate { get;  set; }
		IfcDateTime? @EarlyDate { get;  set; }
		IfcDateTime? @LateDate { get;  set; }
		IfcDateTime? @ScheduleDate { get;  set; }
	
	}
}

namespace Xbim.Ifc4.DateTimeResource
{
	[ExpressType("IfcEventTime", 1169)]
	// ReSharper disable once PartialTypeWithSinglePart
	public  partial class @IfcEventTime : IfcSchedulingTime, IInstantiableEntity, IIfcEventTime, IEquatable<@IfcEventTime>
	{
		#region IIfcEventTime explicit implementation
		IfcDateTime? IIfcEventTime.ActualDate { 
 
			get { return @ActualDate; } 
			set { ActualDate = value;}
		}	
		IfcDateTime? IIfcEventTime.EarlyDate { 
 
			get { return @EarlyDate; } 
			set { EarlyDate = value;}
		}	
		IfcDateTime? IIfcEventTime.LateDate { 
 
			get { return @LateDate; } 
			set { LateDate = value;}
		}	
		IfcDateTime? IIfcEventTime.ScheduleDate { 
 
			get { return @ScheduleDate; } 
			set { ScheduleDate = value;}
		}	
		#endregion

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

		#region Explicit attribute fields
		private IfcDateTime? _actualDate;
		private IfcDateTime? _earlyDate;
		private IfcDateTime? _lateDate;
		private IfcDateTime? _scheduleDate;
		#endregion
	
		#region Explicit attribute properties
		[EntityAttribute(4, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 4)]
		public IfcDateTime? @ActualDate 
		{ 
			get 
			{
				if(_activated) return _actualDate;
				Activate();
				return _actualDate;
			} 
			set
			{
				SetValue( v =>  _actualDate = v, _actualDate, value,  "ActualDate", 4);
			} 
		}	
		[EntityAttribute(5, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 5)]
		public IfcDateTime? @EarlyDate 
		{ 
			get 
			{
				if(_activated) return _earlyDate;
				Activate();
				return _earlyDate;
			} 
			set
			{
				SetValue( v =>  _earlyDate = v, _earlyDate, value,  "EarlyDate", 5);
			} 
		}	
		[EntityAttribute(6, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 6)]
		public IfcDateTime? @LateDate 
		{ 
			get 
			{
				if(_activated) return _lateDate;
				Activate();
				return _lateDate;
			} 
			set
			{
				SetValue( v =>  _lateDate = v, _lateDate, value,  "LateDate", 6);
			} 
		}	
		[EntityAttribute(7, EntityAttributeState.Optional, EntityAttributeType.None, EntityAttributeType.None, null, null, 7)]
		public IfcDateTime? @ScheduleDate 
		{ 
			get 
			{
				if(_activated) return _scheduleDate;
				Activate();
				return _scheduleDate;
			} 
			set
			{
				SetValue( v =>  _scheduleDate = v, _scheduleDate, value,  "ScheduleDate", 7);
			} 
		}	
		#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: 
					_actualDate = value.StringVal;
					return;
				case 4: 
					_earlyDate = value.StringVal;
					return;
				case 5: 
					_lateDate = value.StringVal;
					return;
				case 6: 
					_scheduleDate = 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(@IfcEventTime other)
	    {
	        return this == other;
	    }
        #endregion

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