using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.ViewModels;
using PrecastConcretePlantDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrecastConcretePlantListImplement.Models
{
    public class Shop : IShopModel
    {
        public string Name { get; private set; } = string.Empty;

        public string Address { get; private set; } = string.Empty;

        public DateTime DateOpening { get; private set; }

        public Dictionary<int, (IReinforcedModel, int)> ShopReinforcedies { get; private set; } = new();

        public int Id { get; private set; }

        public static Shop? Create(ShopBindingModel? model)
        {
            if (model == null)
            {
                return null;
            }
            return new Shop()
            {
                Id = model.Id,
                Name = model.Name,
                Address = model.Address,
                DateOpening = model.DateOpening,
                ShopReinforcedies = new()
            };
        }
        public void Update(ShopBindingModel? model)
        {
            if (model == null)
            {
                return;
            }
            Name = model.Name;
            Address = model.Address;
            DateOpening = model.DateOpening;
            ShopReinforcedies = model.ShopReinforcedies;
        }
        public ShopViewModel GetViewModel => new()
        {
            Id = Id,
            Name = Name,
            Address = Address,
            ShopReinforcedies = ShopReinforcedies,
            DateOpening = DateOpening,
        };
        public int ReinforcedMaxCount => throw new NotImplementedException();
    }
}
