using Hotline.Settings;
using Hotline.Share.Enums.KnowledgeBase;
using Hotline.Users;
using SqlSugar;
using System.ComponentModel;
using XF.Domain.Repository;

namespace Hotline.KnowledgeBase;

/// <summary>
/// 申请
/// </summary>
[Description("知识申请")]
public class KnowledgeApply : FullStateEntity
{
    /// <summary>
    /// 知识ID
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string KnowledgeId { get; set; }

    /// <summary>
    /// 知识Code
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string Code { get; set; }

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

    /// <summary>
    /// 申请类型
    /// </summary>
    public EApplyType KnowledgeApplyType { get; set; }

    /// <summary>
    /// 申请状态
    /// </summary>
    public EKnowledgeApplyStatus Status { get; set; }

    /// <summary>
    /// 处理部门Id
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string DepartmentId { get; set; }

    /// <summary>
    /// 处理部门名称
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string Department { get; set; }

    /// <summary>
    /// 处理人Id
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string ProcessorId { get; set; }

    /// <summary>
    /// 处理人
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string Processor { get; set; }

    /// <summary>
    /// 截止时间
    /// </summary>
    public DateTime? ExpiredTime { get; set; }

    /// <summary>
    /// 是否已经超期
    /// </summary>
    public bool IsOvertime { get; set; } = false;

    /// <summary>
    /// 处理完成时间
    /// </summary>
    public DateTime? HandleTime { get; set; }

    /// <summary>
    /// 退回时间
    /// </summary>
    public DateTime? ReturnTime { get; set; }

    /// <summary>
    /// 撤销时间
    /// </summary>
    public DateTime? RevokeTime { get; set; }

    /// <summary>
    /// 办理或者退回意见
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string Opinion { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(CreatorId))]//一对一 CreatorId是KnowledgeApply类里面的
    public User User { get; set; }

    /// <summary>
    /// 创建部门
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(CreatorOrgId))]//一对一 
    public SystemOrganize SystemOrganize { get; set; }

}