using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CollaborativePlatformMain.DFEntity.MessageSubUtil
{
    /// <summary>
    /// 
    /// <para>文件名(File Name):     OperatEntity.cs</para>
    /// 
    /// <para>描述(Description):     工作台展示数据</para>
    /// 
    /// <para>数据表(Tables):        nothing</para>
    /// 
    /// <para>作者(Author):          Ou Rui Song</para>
    /// 
    /// <para>日期(Create Date):     2024年5月5日16:18:46</para>
    /// 
    /// 修改记录(Revision History):
    ///     R1:
    ///         修改作者:
    ///         修改日期:
    ///         修改理由:
    /// 
    /// </summary>
    public class OperatEntity: INotifyPropertyChanged
    {
        /// <summary>
        /// 展示数据
        /// </summary>
        /// <param name="node">内容</param>
        /// <param name="drawPath">图纸地址</param>
        /// <param name="subDatas">子级数据</param>
        /// <param name="isLayer">是否为图层</param>
        public OperatEntity(string node, string drawPath, ObservableCollection<OperatEntity> subDatas, bool isLayer) 
        {
            Node = node;
            DrawPath = drawPath;
            SubDatas = subDatas;
            IsLayer = isLayer;
        }


        /// <summary>
        /// 唯一id
        /// </summary>
        public string Id { get; set; } = Guid.NewGuid().ToString();

        /// <summary>
        /// 内容
        /// </summary>
        public string Node { get; set; }

        /// <summary>
        /// 图纸地址
        /// </summary>
        public string DrawPath { get; set; }

        /// <summary>
        /// 子级数据
        /// </summary>
        public ObservableCollection<OperatEntity> SubDatas { get; set; } = new ObservableCollection<OperatEntity>();


        /// <summary>
        /// 是否为图层
        /// </summary>
        public bool IsLayer { get; set; } = false;

        /// <summary>
        /// 是否展示
        /// </summary>
        public string isShow { get; set; } = "Collapsed";

        /// <summary>
        /// 是否展示
        /// </summary>
        public string IsShow
        {
            get { return isShow; }
            set
            {
                if (value != isShow)
                {
                    isShow = value;
                    NotifyPropertyChanged("IsShow");
                }
            }
        }

        /// <summary>
        /// 是否选中
        /// </summary>
        public bool isCheck { get; set; } = false;

        /// <summary>
        /// 是否选中
        /// </summary>
        public bool IsCheck
        {
            get { return isCheck; }
            set
            {
                if (value != isCheck)
                {
                    isCheck = value;
                    NotifyPropertyChanged("IsCheck");
                }
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
