using APT.BaseData.Domain.ApiModel.Platform;
using System;
using System.Collections.Generic;
using System.Text;

namespace APT.BaseData.Domain.ApiModel.PF
{
    /// <summary>
    /// 可编辑的Table的模型
    /// </summary>
    public class EditListModel
    {
        /// <summary>
        /// List（外）：数据集合
        /// List（里）：字段值集合
        /// </summary>
        public List<List<DataValModel>> data { get; set; }
        /// <summary>
        /// table的列头定义
        /// </summary>
        public List<Column> columns { get; set; }

    }

    /// <summary>
    /// 单元格属性
    /// </summary>
    public class DataValModel
    {
        /// <summary>
        /// 字段名称
        /// </summary>
        public string fieldName { get; set; }
        /// <summary>
        /// 字段值
        /// </summary>
        public string value { get; set; }
        /// <summary>
        /// 列合并
        /// </summary>
        public int colSpan { get; set; } = 1;
        /// <summary>
        /// 行合并
        /// </summary>
        public int rowSpan { get; set; } = 1;

        /// <summary>
        /// PFControlTypeEnum  暂时只支持1 文本  7 数值文本
        /// </summary>
        public int controlType { get; set; } = 1;
        /// <summary>
        /// 单元格的背景颜色
        /// </summary>
        public string backgroundColor { get; set; }
        /// <summary>
        /// 单元格的字体颜色
        /// </summary>
        public string fontColor { get; set; }
        /// <summary>
        /// 是否不可编辑（默认可编辑）
        /// </summary>
        public bool disabled { get; set; } = false;
        /// <summary>
        /// 正则表达式
        /// </summary>
        public string rule { get; set; }
        /// <summary>
        /// 检验失败提示信息
        /// </summary>
        public string errorMsg { get; set; }
    }

    /// <summary>
    /// 可编辑表格列头部定义
    /// </summary>
    public class Column
    {
        public Column(string dataTitle, string dataFieldName)
        {
            this.title = dataTitle;
            this.key = dataFieldName;
            this.dataIndex = dataFieldName;
            this.children = new List<Column>();
        }
        public Column()
        {
           // this.children = new List<Cloumn>();
        }
        /// <summary>
        /// 显示名称
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 字段
        /// </summary>
        public string key { get; set; }
        /// <summary>
        /// 列宽度
        /// </summary>
        public int width { get; set; }
        /// <summary>
        /// 字段
        /// </summary>
        public string dataIndex { get; set; }
        /// <summary>
        /// 子集
        /// </summary>
        public List<Column> children { get; set; }
    }
}
