using MeterVision.db;
using MeterVision.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace MeterVision.model
{
    public class CompDetailItem : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }


        private int _index;
        public int Index
        {
            get => _index;
            set
            {
                if (_index != value)
                {
                    _index = value;
                    OnPropertyChanged(nameof(Index));
                }
            }
        }

        public Visibility ResultVisiable
        {
            get => Visibility.Visible;
        }


        public string CompId { get; set; }

        public string CreateTime { get; set; }

        public string NPatchId { get; set; }

        public string OPatchId { get; set; }

        public string StandId { get; set; }

        //private PatchDetailItem _detail1;
        //public PatchDetailItem Detail1
        //{
        //    get => _detail1;
        //    set
        //    {
        //        if(_detail1 != value)
        //        {
        //            _detail1 = value;
        //            OnPropertyChanged(nameof(Detail1));
        //        }
        //    }
        //}



        //private PatchDetailItem _detail2;
        //public PatchDetailItem Detail2
        //{
        //    get => _detail2;
        //    set
        //    {
        //        if (_detail2 != value)
        //        {
        //            _detail2 = value;
        //            OnPropertyChanged(nameof(Detail2));
        //        }
        //    }
        //}
        public PatchDetailItem Detail1 { get; set; }
        public PatchDetailItem Detail2 { get; set; }

        public CompDetailItem(VCompDetail compDetail)
        {
            ObjectHelper.CopyMatchingFields(compDetail, this);
            Detail1 = new PatchDetailItem(compDetail.PatchDetail1);
            Detail2 = new PatchDetailItem(compDetail.PatchDetail2);
        }
        //----------------------------------------
    }
}
