//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;

namespace CommunityServer.Components {
    /// <summary>
    /// Summary description for VoteResults.
    /// </summary>
    public class PollItem : IComparable
	{
        string answerID;
		string answer;
        int total;
		int orderNumber;

		public PollItem(string answer)
		{
			this.answer = answer;
		}

		public PollItem (string answerID, string answer, int orderNumber) 
		{
			this.answerID = answerID;
			this.answer = answer;
			this.orderNumber = orderNumber;
		}

		public string Answer 
		{
			get { return answer; }
			set	{ answer = value; }
		}

        public string AnswerID 
		{
            get { return answerID; }
			set { answerID = value;}
        }

		public int OrderNumber 
		{
			get { return orderNumber; }
			set { orderNumber = value; }
		}

        public int Total 
		{
            get { return total; }
            set { total = value; }
        }

		public void Increment() 
		{
			total++;
		}

		#region IComparable Members

		public int CompareTo(object obj)
		{
			int res;
			PollItem item2 = (PollItem) obj;
			if ((res = this.OrderNumber.CompareTo(item2.OrderNumber)) == 0)
				return this.AnswerID.CompareTo(item2.AnswerID);
			else
				return res;
		}

		#endregion
	}
}
