using System.ComponentModel.DataAnnotations;

namespace MileageTraker.Web.Models
{
	public enum MileageLogType
	{
		[Display(Name = "Non-Commuting",ShortName = "Non-Comm")] 
		NonCommuting = 1,
		[Display(Name = "Commuting", ShortName = "Comm")]
		Commuting = 2,
		[Display(Name = "Gas Purchase", ShortName = "Gas")] 
		GasPurchase = 3
	}

	[ComplexType]
	public class MileageLogTypeWrapper
	{
		[NotMapped]
		public MileageLogType Enum { get; set; }

		public int Value
		{
			get { return (int)Enum; }
			set { Enum = (MileageLogType)value; }
		}
		
		public static implicit operator MileageLogType(MileageLogTypeWrapper w)
		{
			return w == null ? default(MileageLogType) : w.Enum; 
		}

		public static implicit operator MileageLogTypeWrapper(MileageLogType c)
		{
			return new MileageLogTypeWrapper { Enum = c };
		}
	}
}