using NPin.Framework.SqlSugarCore.Abstractions.Data;
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;

namespace NPin.Framework.Upms.Domain.Entities;

[SugarTable("Organization", "组织机构表")]
public class OrganizationEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IEnabled
{
    [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键")]
    public override Guid Id { get; protected set; }

    [SugarColumn(ColumnDescription = "组织机构名称")]
    public string Name { get; set; } = string.Empty;

    [SugarColumn(ColumnDescription = "组织机构编码")]
    public string Code { get; set; } = string.Empty;

    [SugarColumn(ColumnDescription = "描述")]
    public string? Remark { get; set; }

    /// <summary>
    /// 负责人ID
    /// </summary>
    public Guid LeaderId { get; set; }

    /// <summary>
    /// 负责人名称，仅用户展示，不存储
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public string Leader { get; set; }

    /// <summary>
    /// 父节点 ID
    /// </summary>
    public Guid ParentId { get; set; }

    public bool IsDeleted { get; }
    public DateTime CreationTime { get; } = DateTime.Now;
    public Guid? CreatorId { get; }
    public DateTime? LastModificationTime { get; }
    public Guid? LastModifierId { get; }
    public int OrderNum { get; set; }
    public bool IsEnabled { get; set; }
}