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

namespace CarCenterContracts.ViewModels
{
    public class InspectionViewModel : IInspectionModel
    {
        public int Id { get; set; }

        [DisplayName("Название осмотра")]
        public string InspectionName { get; set; } = string.Empty;

        [DisplayName("Дата осмотра")]
		[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
		public DateTime? InspectionDate { get; set; }
        public int AdministratorId { get; set; }
        public int? EmployeeId { get; set; }

        public string EmployeeName { get; set; } = string.Empty;
        public Dictionary<int, ICarModel> InspectionCars { get; set; } = new();
		public InspectionViewModel() { }

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