using CarCenterDataModels.Models;
using System.ComponentModel;
using Newtonsoft.Json;

namespace CarCenterContracts.ViewModels
{
    public class PreSaleWorkViewModel : IPreSaleWorkModel
    {
        [DisplayName("Тип предпродажной работы")]
        public string PreSaleWorkType { get; set; } = string.Empty;

        [DisplayName("Стоимость предпродажной работы")]
        public double PreSaleWorkPrice { get; set; }

        public int ManagerId { get; set; }

        public int Id { get; set; }

        public Dictionary<int, ISaleModel> PreSaleWorkSales { get; set; } = new();
        public Dictionary<int, ICarModel> PreSaleWorkCars { get; set; } = new();

        public PreSaleWorkViewModel() { }

        [JsonConstructor]
        public PreSaleWorkViewModel(Dictionary<int, SaleViewModel> PreSaleWorkSales, Dictionary<int, CarViewModel> PreSaleWorkCars)
        {
            this.PreSaleWorkSales = PreSaleWorkSales.ToDictionary(x => x.Key, x => x.Value as ISaleModel);
            this.PreSaleWorkCars = PreSaleWorkCars.ToDictionary(x => x.Key, x => x.Value as ICarModel);
        }
    }
}
