using SqlSugar;
using System.ComponentModel;
using Hotline.Settings;
using XF.Domain.Repository;

namespace Hotline.KnowledgeBase;

/// <summary>
/// 知识分类
/// </summary>
[Description("知识分类")]
public class KnowledgeType : FullStateEntity
{
    /// <summary>
    /// 类型名称
    /// </summary>
    public string Name { get; set; }

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

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

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

    /// <summary>
    /// 父级ID
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string? ParentId { get; set; }


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

    /// <summary>
    /// 类型关联机构
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(KnowledgeTypeOrg.TypeId))]
    public List<KnowledgeTypeOrg> KnowledgeTypeOrgs { get; set; }

    [Navigate(typeof(KnowledgeTypeOrg), nameof(KnowledgeTypeOrg.TypeId), nameof(KnowledgeTypeOrg.OrgId))]
    public List<SystemOrganize> Orgs { get; set; }

    [Navigate(typeof(KnowledgeRelationType), nameof(KnowledgeRelationType.KnowledgeTypeId), nameof(KnowledgeRelationType.KnowledgeId))]
    public List<Knowledge> Knowledges { get; set; }
}