using DressAtelierContracts.BindingModels;
using DressAtelierContracts.BusinessLogicContracts;
using DressAtelierContracts.ViewModels;
using DressAtelierDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace DressAtelierListImplement.Models
{
    public class Employee : IEmployeeModel
    {
        public int ID { get; set; }
        public string FullName { get; set; } = string.Empty;
        public string Password { get; set; } = string.Empty;
        public int WorkExperience { get; set; }
        public int Qualification { get; set; }

        public static Employee? Create(EmployeeBindingModel? model)
        {
            if (model == null)
            {
                return null;
            }
            return new Employee()
            {
                ID = model.ID,
                FullName = model.FullName,
                WorkExperience = model.WorkExperience,
                Password = model.Password,
                Qualification = model.Qualification
            };
        }

        public void Update(EmployeeBindingModel? model)
        {
            if (model == null) { return; }
            FullName = model.FullName;
            WorkExperience = model.WorkExperience;
            Password = model.Password;
            Qualification = model.Qualification;
        }

        public EmployeeViewModel GetViewModel => new()
        {
            ID = ID,
            FullName = FullName,
            WorkExperience = WorkExperience,
            Password = Password,
            Qualification = Qualification
        };
    }
}
