using CarCenterDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace CarCenterContracts.ViewModels
{
    public class EquipmentViewModel : IEquipmentModel
    {
        public int Id { get; set; }

        [DisplayName("Название комплектации")]
        public string EquipmentName { get; set; } = string.Empty;

        [DisplayName("Цена комплектации")]
        public double EquipmentPrice { get; set; }

		[DisplayName("Дата создания")]
		public DateTime DateCreateEquipment { get; set; }
		public int AdministratorId { get; set; }
        public int? PreSaleWorkId { get; set; }
        public Dictionary<int, ICarModel> EquipmentCars { get; set; } = new();
		public EquipmentViewModel() { }

		[JsonConstructor]
		public EquipmentViewModel(Dictionary<int, CarViewModel> EquipmentCars)
		{
			this.EquipmentCars = EquipmentCars.ToDictionary(x => x.Key, x => x.Value as ICarModel);
		}
	}
}
