using System.ComponentModel.DataAnnotations;

namespace InventoryTraker.Web.Models
{
	public class UserEditForm
	{
		[Required]
		[StringLength(128)]
		[RegularExpression(@"[A-Za-z().]+(\s+[A-Za-z().]+)+", ErrorMessage = "Need complete name")]
		public string UserName { get; set; }
		
		[Required]
		[DataType(DataType.EmailAddress)]
		[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "Must be an email address")]
		public string Email { get; set; }

		//[Required]
		public bool Administrator { get; set; }

		[DataType(DataType.Password)]
		public string Password { get; set; }

		[DataType(DataType.Password)]
		[Compare("Password")]
		public string ConfirmPassword { get; set; }

		public override string ToString()
		{
			return $"UserName: {UserName}, email: {Email}";
		}
	}
}