namespace Admin.NET.Plugin.ApprovalFlow;
///
/// 审批流通知推送日志(P4-16)
/// 记录每次 NotifyUsers 按渠道分发的结果,便于运维排障与降级审计。
/// 一条记录 = 一次(实例 × 通知类型 × 渠道)的分发结果(接收用户合并入 TargetUserIds / TargetCount)。
///
[SugarTable(null, "审批流通知推送日志")]
[SugarIndex("idx_flownotifylog_instance", nameof(InstanceId), OrderByType.Asc)]
public class ApprovalFlowNotifyLog : EntityBase
{
///
/// 关联流程实例 Id
///
[SugarColumn(ColumnDescription = "流程实例Id")]
public long InstanceId { get; set; }
///
/// 通知类型(NewTask / Urge / FlowCompleted / Transferred / Returned / AddSign / Withdrawn / Escalated / Timeout)
///
[SugarColumn(ColumnDescription = "通知类型", Length = 32, IsNullable = true)]
[MaxLength(32)]
public string? NotifyType { get; set; }
///
/// 推送渠道(SignalR / Email / Sms / DingTalk / WorkWeixin)
///
[SugarColumn(ColumnDescription = "推送渠道", Length = 16)]
[MaxLength(16)]
public string Channel { get; set; } = "";
///
/// 通知标题(冗余便于检索)
///
[SugarColumn(ColumnDescription = "通知标题", Length = 256, IsNullable = true)]
[MaxLength(256)]
public string? Title { get; set; }
///
/// 目标用户 Id 列表(CSV,最多保留 1024 字符)
///
[SugarColumn(ColumnDescription = "目标用户ID列表CSV", Length = 1024, IsNullable = true)]
[MaxLength(1024)]
public string? TargetUserIds { get; set; }
///
/// 目标用户数
///
[SugarColumn(ColumnDescription = "目标用户数")]
public int TargetCount { get; set; }
///
/// 是否成功(至少一次底层调用未抛异常视为成功;对于 SignalR 若无在线用户也记 true)
///
[SugarColumn(ColumnDescription = "是否成功")]
public bool Success { get; set; }
///
/// 错误信息(失败时填充,最多 1024 字符)
///
[SugarColumn(ColumnDescription = "错误信息", Length = 1024, IsNullable = true)]
[MaxLength(1024)]
public string? ErrorMessage { get; set; }
///
/// 耗时毫秒
///
[SugarColumn(ColumnDescription = "耗时ms")]
public int ElapsedMs { get; set; }
}