using SqlSugar;

namespace OpenAuth.Repository.Domain.workflow;

/// <summary>
/// 流程工作项表（zy_flow_workitem）
/// </summary>
[SugarTable("zy_flow_workitem")]
public class ZyFlowWorkitem
{
    /// <summary>
    /// 工作项ID（主键，自增）
    /// </summary>
    [SugarColumn(ColumnName = "workitem_id", IsPrimaryKey = true, IsIdentity = true, IsNullable = false)]
    public long WorkitemId { get; set; }

    /// <summary>
    /// 流程实例ID（外键关联zy_flow_instance）
    /// </summary>
    [SugarColumn(ColumnName = "instance_id", IsNullable = false)]
    public long InstanceId { get; set; }

    /// <summary>
    /// 节点ID
    /// </summary>
    [SugarColumn(ColumnName = "node_id", IsNullable = false)]
    public long NodeId { get; set; }

    /// <summary>
    /// 节点名称
    /// </summary>
    [SugarColumn(ColumnName = "node_name", IsNullable = false)]
    public string NodeName { get; set; } = string.Empty;

    /// <summary>
    /// 处理人ID
    /// </summary>
    [SugarColumn(ColumnName = "handler_id", IsNullable = true)]
    public long? HandlerId { get; set; }

    /// <summary>
    /// 处理人姓名
    /// </summary>
    [SugarColumn(ColumnName = "handler_name", IsNullable = true)]
    public string? HandlerName { get; set; }

    /// <summary>
    /// 工作项状态（ToDo/Done/Draft）
    /// </summary>
    [SugarColumn(ColumnName = "status", IsNullable = false)]
    public string Status { get; set; } = string.Empty;

    /// <summary>
    /// 接收时间（默认当前时间）
    /// </summary>
    [SugarColumn(ColumnName = "receive_time", IsNullable = true)]
    public DateTime? ReceiveTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 处理时间
    /// </summary>
    [SugarColumn(ColumnName = "handle_time", IsNullable = true)]
    public DateTime? HandleTime { get; set; }

    /// <summary>
    /// 处理意见
    /// </summary>
    [SugarColumn(ColumnName = "comment", IsNullable = true)]
    public string? Comment { get; set; }
}