using SushiBarContracts.BindingModels;
using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;

namespace SushibarListImplement.Models;

public class Implementer : IImplementerModel
{
    public int Id { get; set; }
    public string ImplementerFio { get; set; }
    public string Password { get; set; }
    public int WorkExperience { get; set; }
    public int Qualification { get; set; }
    
    public static Implementer? Create(ImplementerBindingModel model)
    {
        return new Implementer
        {
            Id = model.Id,
            Password = model.Password,
            Qualification = model.Qualification,
            ImplementerFio = model.ImplementerFio,
            WorkExperience = model.WorkExperience,
        };
    }

    public void Update(ImplementerBindingModel model)
    {
        Password = model.Password;
        Qualification = model.Qualification;
        ImplementerFio = model.ImplementerFio;
        WorkExperience = model.WorkExperience;
    }

    public ImplementerViewModel GetViewModel => new()
    {
        Id = Id,
        Password = Password,
        Qualification = Qualification,
        ImplementerFio = ImplementerFio,
    };
}