using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.ViewModels;
using BlacksmithWorkshopDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BlacksmithWorkshopListImplement.Models
{
    public class Shop : IShopModel
    {
        public int Id {  get; private set; }
        public string ShopName { get; private set; } = string.Empty;
        public string Address { get; private set; } = string.Empty;
        public DateTime OpeningDate { get; private set; }
        public Dictionary<int, (IManufactureModel, int)> ShopManufactures { get; private set; } = new();
        public static Shop? Create(ShopBindingModel? model)
        {
            if (model == null)
            {
                return null;
            }
            return new Shop()
            {
                Id = model.Id,
                ShopName = model.ShopName,
                Address = model.Address,
                OpeningDate = model.OpeningDate,
                ShopManufactures = model.ShopManufactures
            };
        }
        public void Update(ShopBindingModel? model)
        {
            if (model == null)
            {
                return;
            }
            ShopName = model.ShopName;
            Address = model.Address;
            OpeningDate = model.OpeningDate;
            ShopManufactures = model.ShopManufactures;
        }
        public ShopViewModel GetViewModel => new ShopViewModel()
        {
            Id = Id,
            ShopName = ShopName,
            Address = Address,
            OpeningDate = OpeningDate,
            ShopManufactures = ShopManufactures
        };
        public int MaxCapacity => throw new NotImplementedException();
    }
}
