using System;

namespace StatementMachineService.Model
{
    public class SingalEvent:IComparable
    {
        public SingalEvent(int identifier)
        {
            this.Identifier = identifier;
        }

        public int Identifier { get; set; }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != GetType())
            {
                return false;
            }

            return this.Equals((SingalEvent)obj);
        }

        public override int GetHashCode()
        {
            return this.Identifier;
        }

        public int CompareTo(object obj)
        {
            throw new InvalidOperationException("state machine should not use CompareTo");
        }

        protected bool Equals(SingalEvent other)
        {
            return this.Identifier == other.Identifier;
        }
    }
}