using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace DiplomovaPrace.Contracts.Customer.Addresses.InputModels
{
	public class CreateAddressIM
	{
		public string FirstName { get; set; }

		public string LastName { get; set; }

		public string PhoneNumber { get; set; }

		public string City { get; set; }

		public string Street { get; set; }

		public string ZipCode { get; set; }

		[Required]
		public int AddressTypeID { get; set; }

		public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
		{
			if (string.IsNullOrWhiteSpace(FirstName))
			{
				yield return new ValidationResult($"FirstName is required.", new[] { nameof(FirstName) });
			}
			if (string.IsNullOrWhiteSpace(LastName))
			{
				yield return new ValidationResult($"LastName is required.", new[] { nameof(LastName) });
			}
			if (string.IsNullOrWhiteSpace(PhoneNumber))
			{
				yield return new ValidationResult($"PhoneNumber is required.", new[] { nameof(PhoneNumber) });
			}
			if (string.IsNullOrWhiteSpace(City))
			{
				yield return new ValidationResult($"City is required.", new[] { nameof(City) });
			}
			if (string.IsNullOrWhiteSpace(Street))
			{
				yield return new ValidationResult($"Street is required.", new[] { nameof(Street) });
			}
			if (string.IsNullOrWhiteSpace(ZipCode))
			{
				yield return new ValidationResult($"ZipCode is required.", new[] { nameof(ZipCode) });
			}
		}
	}
}
