using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sevomin.Models
{
    public class AvalinViewModel
    {
        public string DisplayName
        {
            get
            {
                return this.CompanyName;
            }
        }

        [Required]
        [DisplayName("نام شرکت")]
        public string CompanyName { get; set; }

        [StringLength(12)]
        [DisplayName("شناسه ملی")]
        public string NationalId { get; set; }
        
        [StringLength(10)]
        [DisplayName("شماره ثبت")]
        public string RegisterId { get; set; }

        [DisplayName("آدرس")]
        public string Address { get; set; }

        [DisplayName("شماره تماس")]
        public string CompanyPhoneNumber { get; set; }

        [RegularExpression(@"^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-zA-Z0-9]{1}[a-zA-Z0-9\-]{0,62}[a-zA-Z0-9]{1})|[a-zA-Z])\.)+[a-zA-Z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$", ErrorMessage = "لطفا ایمیل معتبر وارد کنید.")]
        [DisplayName("ایمیل")]
        public string EMail { get; set; }

        public AvalinViewModel(Avalin avalin)
        {
            this.CompanyName = avalin.CompanyName;
            this.NationalId = avalin.NationalId;
            this.RegisterId = avalin.RegisterId;
            this.Address = avalin.Address;
            this.CompanyPhoneNumber = avalin.CompanyPhoneNumber;
            this.EMail = avalin.Email;
        }
    }
}
