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;

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

        protected virtual 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 string CompId { get; set; }
        public string CreateTime { get; set; }

        public string CreateTimeName
        {
            get => ThisApp.ConvertDateFormat(CreateTime);
        }


        public string StandId { get; set; }
        public string StandName { get; set; }
        public int StandCount { get; set; }


        public string NPatchId { get; set; }
        public string NPatchName { get; set; }
        public string NPatchTime { get; set; }
        public string NPatchTimeName
        {
            get => ThisApp.ConvertDateFormat(NPatchTime);
        }

        public int NPatchDetailCount { get; set; }
        public int NPatchEqualCount { get; set; }

        public float NPatchEqualRate
        {
            get => (float)NPatchEqualCount / NPatchDetailCount;
        }


        public string OPatchId { get; set; }
        public string OPatchName { get; set; }
        public string OPatchTime { get; set; }
        public string OPatchTimeName
        {
            get => ThisApp.ConvertDateFormat(OPatchTime);
        }

        public int OPatchDetailCount { get; set; }
        public int OPatchEqualCount { get; set; }
        public float OPatchEqualRate
        {
            get => (float)OPatchEqualCount / OPatchDetailCount;
        }

        public CompItem()
        {

        }

        public CompItem(VComp vComp)
        {
            ObjectHelper.CopyMatchingFields(vComp, this);
        }
       //----------------------------------------------------------------------
    }
}
