using Oms.Domain.ApprovalAggregate.Enums;
using Oms.Domain.Shared;
using SqlSugar;
namespace Oms.Domain.ApprovalAggregate.Entities;
///
/// 审批实例。
///
[SugarTable("t_approval_instance")]
public class ApprovalInstance : OmsAuditedAggregateRoot
{
/// 实例单号。
[SugarColumn(Length = 32)]
public string InstanceNo { get; set; } = string.Empty;
/// 操作编码。
[SugarColumn(Length = 128)]
public string OperationCode { get; set; } = string.Empty;
/// 业务幂等键。
[SugarColumn(Length = 128)]
public string BizKey { get; set; } = string.Empty;
/// 摘要标题。
[SugarColumn(Length = 256)]
public string Title { get; set; } = string.Empty;
/// 实例状态。
public ApprovalInstanceStatus Status { get; set; } = ApprovalInstanceStatus.Pending;
/// 申请人 mapId。
public int ApplicantUserId { get; set; }
/// 申请人 RBAC Guid。
[SugarColumn(Length = 36)]
public string ApplicantUserGuid { get; set; } = string.Empty;
/// 申请人显示名。
[SugarColumn(Length = 64, IsNullable = true)]
public string? ApplicantUserName { get; set; }
/// 冻结业务载荷。
[SugarColumn(ColumnDataType = "mediumtext", IsNullable = true)]
public string? PayloadJson { get; set; }
/// 载荷哈希。
[SugarColumn(Length = 64, IsNullable = true)]
public string? PayloadHash { get; set; }
/// 展示摘要 JSON。
[SugarColumn(Length = 2000, IsNullable = true)]
public string? SummaryJson { get; set; }
/// 提交时定义快照。
[SugarColumn(ColumnDataType = "mediumtext", IsNullable = true)]
public string? DefinitionSnapshot { get; set; }
/// 当前任务 Id。
[SugarColumn(IsNullable = true)]
public int? CurrentTaskId { get; set; }
/// 终审完成时间。
[SugarColumn(IsNullable = true)]
public DateTime? CompletedTime { get; set; }
/// 业务执行完成时间。
[SugarColumn(IsNullable = true)]
public DateTime? ExecutedTime { get; set; }
/// 执行结果/失败信息。
[SugarColumn(Length = 1000, IsNullable = true)]
public string? ExecuteMessage { get; set; }
}