using SewingDressesContracts.BindingModels;
using SewingDressesContracts.ViewModels;
using SewingDressesDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SewingDressesListImplement.Models
{
	public class Implement : IImplementModel
	{
		public int Id { get; private set; }
		public string ImplementFIO { get; private set; } = string.Empty;
		public string Password { get; set; } = string.Empty;
		public int WorkExperience { get; set; } = 0;
		public int Qualification { get; set; } = 0;
		public static Implement? Create(ImplementBindingModel model)
		{
			if (model == null)
			{
				return null;
			}
			return new Implement()
			{
				Id = model.Id,
				ImplementFIO = model.ImplementFIO,
				Password = model.Password,
				WorkExperience = model.WorkExperience,
				Qualification = model.Qualification
			};
		}
		public void Update(ImplementBindingModel model)
		{
			if (model == null)
			{
				return;
			}
			ImplementFIO = model.ImplementFIO;
			Password = model.Password;
			WorkExperience = model.WorkExperience;
			Qualification = model.Qualification;
		}
		public ImplementViewModel GetViewModel => new()
		{
			Id = Id,
			ImplementFIO = ImplementFIO,
			Password = Password,
			WorkExperience = WorkExperience,
			Qualification = Qualification
		};
	}
}
