﻿using DertInfo.WEB.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DertInfo.WEB.ViewModels.AccessKeyVMs
{
    public class AccessKeyUserViewModel
    {
        public AccessKeyUserViewModel()
        { 
        }

        public AccessKeyUserViewModel(AccessKeyUser accessKeyUser)
        {
            this.ToView(accessKeyUser);
        }

        //Properties

        public int AccessKeyUserId {get; set;}
        public int AccessKeyId {get; set;}
        public string Username {get; set;}

        public bool ViewPermitted {get; set;}
        public bool EditPermitted {get; set;}
        public bool DeletePermitted {get; set;}

        public DateTime DateCreated { get; set; }
        public DateTime DateModified { get; set; }
        public string CreatedBy { get; set; }
        public string ModifiedBy { get; set; }
        public bool IsDeleted { get; set; }

        internal void ToView(AccessKeyUser accessKeyUser)
        {

            this.AccessKeyUserId = accessKeyUser.Id;
            this.AccessKeyId = accessKeyUser.AccessKeyId;
            this.Username = accessKeyUser.Username;

            this.ViewPermitted = accessKeyUser.ViewPermitted;
            this.EditPermitted = accessKeyUser.EditPermitted;
            this.DeletePermitted = accessKeyUser.DeletePermitted;

            //Status
            this.DateCreated = accessKeyUser.DateCreated;
            this.DateModified = accessKeyUser.DateModified;
            this.CreatedBy = accessKeyUser.CreatedBy;
            this.ModifiedBy = accessKeyUser.ModifiedBy;
            this.IsDeleted = accessKeyUser.IsDeleted;
        }
    }
}