using Hotline.Settings;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.Knowledge
{
    /// <summary>
    /// 编辑
    /// </summary>
    public record UpdateKnowledgeTypeDto : AddKnowledgeTypeDto
    {
        /// <summary>
        /// ID
        /// </summary>
        public string Id { get; set; }
    }

    /// <summary>
    ///新增
    /// </summary>
    public record AddKnowledgeTypeDto
    {
        /// <summary>
        /// 类型名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 父级ID
        /// </summary>
        public string? ParentId { get; set; } 

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; } = 0;

        public List<AddKnowledgeTypeOrgDto>? TypeOrgDtos { get; set; }

    }

    /// <summary>
    /// 初始化返回数据
    /// </summary>
    public record KnowledgeTypeDto
    {
        /// <summary>
        /// ID
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 类型名称拼接(所有父级分类名称)
        /// <example>
        /// A类型/A.1类型/A.1.1类型
        /// </example>
        /// </summary>
        public string SpliceName { get; set; }

		/// <summary>
		/// 类型名称
		/// </summary>
		public string Name { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnable { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 父级ID
        /// </summary>
        public string ParentId { get; set; }

        /// <summary>
        /// 树形分类
        /// </summary>
        public List<TreeListDto> TreeLists { get; set; } = new();

        /// <summary>
        /// 子级
        /// </summary>
        public List<KnowledgeTypeDto> children { get; set; }

        public int KnowledgeNum { get; set; }
	}

    public record KnowledgeOrgDto
    {
	    /// <summary>
	    /// ID
	    /// </summary>
	    public string Id { get; set; }

		/// <summary>
		/// 组织架构名称
		/// </summary>
		public string Name { get; set; }

	    /// <summary>
	    /// 组织架构简称
	    /// </summary>
	    public string ShortName { get; set; }

	    /// <summary>
	    /// 区域Code（行政区域代码）
	    /// </summary>
	    public string? AreaCode { get; set; }

	    /// <summary>
	    /// 区域名称（行政区域名称）
	    /// </summary>
	    public string? AreaName { get; set; }

	    /// <summary>
	    /// 部门级别
	    /// </summary>
	    public int Level { get; set; }

	    /// <summary>
	    /// 部门类型
	    /// </summary>
	    public EOrgType OrgType { get; set; }

	    /// <summary>
	    /// 上级ID
	    /// </summary>
	    public string? ParentId { get; set; }

	    /// <summary>
	    /// 上级名称
	    /// </summary>
	    public string? ParentName { get; set; }

	    /// <summary>
	    /// 是否启用
	    /// </summary>
	    public bool IsEnable { get; set; }

	    /// <summary>
	    /// 是否为中心
	    /// </summary>
	    public bool IsCenter { get; set; }

	    public List<KnowledgeOrgDto> Children { get; set; }

	    public string OrgTypeText => OrgType.GetDescription();


	    /// <summary>
	    /// 旧系统id
	    /// </summary>
	    public int? oldBmid { get; set; }

	    public int KnowledgeNum { get; set; }
	}

    public record KnowledgeHotSpotDto
    {
	    /// <summary>
	    /// ID
	    /// </summary>
	    public string Id { get; set; }

	    public int KnowledgeNum { get; set; }

		public string HotSpotName { get; set; }
	    public string ParentId { get; set; }
	    public string PYCode { get; set; }

	    public string FullPYCode { get; set; }
	    public string ProvinceCode { get; set; }
	    public int OrderBy { get; set; }
	    public string TrunkNum { get; set; }
	    /// <summary>
	    /// 生成的时候写入
	    /// </summary>
	    public string HotSpotFullName { get; set; }

	    public List<KnowledgeHotSpotDto> Children { get; set; }

	    public bool HasChild { get; set; }

	}
}
