using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Storage;

namespace VIZ.Package.Domain
{
    /// <summary>
    /// 控制字段节点模型
    /// </summary>
    public class ControlFieldNodeModel : ModelBase
    {
        #region Num -- 编号

        private string num;
        /// <summary>
        /// 编号
        /// </summary>
        public string Num
        {
            get { return num; }
            set { num = value; this.RaisePropertyChanged(nameof(Num)); }
        }

        #endregion

        #region FieldIdentifier -- 字段名称

        private string fieldIdentifier;
        /// <summary>
        /// 字段名称
        /// </summary>
        public string FieldIdentifier
        {
            get { return fieldIdentifier; }
            set { fieldIdentifier = value; this.RaisePropertyChanged(nameof(FieldIdentifier)); }
        }

        #endregion

        #region Description -- 描述

        private string description;
        /// <summary>
        /// 描述
        /// </summary>
        public string Description
        {
            get { return description; }
            set { description = value; this.RaisePropertyChanged(nameof(Description)); }
        }

        #endregion

        #region Value -- 字段值

        private string _value;
        /// <summary>
        /// 字段值
        /// </summary>
        public string Value
        {
            get { return _value; }
            set { _value = value; this.RaisePropertyChanged(nameof(Value)); }
        }

        #endregion

        #region Type -- 字段类型

        private VizControlFieldType type;
        /// <summary>
        /// 字段类型
        /// </summary>
        public VizControlFieldType Type
        {
            get { return type; }
            set { type = value; this.RaisePropertyChanged(nameof(Type)); }
        }

        #endregion

        #region TypeSchema -- 字段类型定义

        private string typeSchema;
        /// <summary>
        /// 字段类型定义
        /// </summary>
        public string TypeSchema
        {
            get { return typeSchema; }
            set { typeSchema = value; this.RaisePropertyChanged(nameof(TypeSchema)); }
        }

        #endregion

        #region FieldDetail -- 字段描述

        private string fieldDetail;
        /// <summary>
        /// 字段描述
        /// </summary>
        public string FieldDetail
        {
            get { return fieldDetail; }
            set { fieldDetail = value; this.RaisePropertyChanged(nameof(FieldDetail)); }
        }

        #endregion

        #region Items -- 子节点集合

        private List<ControlFieldNodeModel> items = new List<ControlFieldNodeModel>();
        /// <summary>
        /// 子节点集合
        /// </summary>
        public List<ControlFieldNodeModel> Items
        {
            get { return items; }
            set { items = value; this.RaisePropertyChanged(nameof(Items)); }
        }

        #endregion

        #region IsCustom -- 是否是自定义字段

        private bool isCustom;
        /// <summary>
        /// 是否是自定义字段
        /// </summary>
        public bool IsCustom
        {
            get { return isCustom; }
            set { isCustom = value; this.RaisePropertyChanged(nameof(IsCustom)); }
        }

        #endregion

        public override string ToString()
        {
            return $"[ {this.FieldIdentifier} ]";
        }
    }
}
