using SqlSugar;

namespace OpenAuth.Repository.Domain.workflow;

/// <summary>
/// 流程实例表（zy_flow_instance）
/// </summary>
[SugarTable("zy_flow_instance")]
public class ZyFlowInstance
{
    /// <summary>
    /// 实例ID（主键，自增）
    /// </summary>
    [SugarColumn(ColumnName = "instance_id", IsPrimaryKey = true, IsIdentity = true, IsNullable = false)]
    public long InstanceId { get; set; }

    /// <summary>
    /// 模板ID（外键关联zy_flow_template）
    /// </summary>
    [SugarColumn(ColumnName = "template_id", IsNullable = false)]
    public long TemplateId { get; set; }

    /// <summary>
    /// 流程编码
    /// </summary>
    [SugarColumn(ColumnName = "flow_code", IsNullable = false)]
    public string FlowCode { get; set; } = string.Empty;

    /// <summary>
    /// 业务编号（唯一）
    /// </summary>
    [SugarColumn(ColumnName = "business_no", IsNullable = false)]
    public string BusinessNo { get; set; } = string.Empty;

    /// <summary>
    /// 流程状态
    /// </summary>
    [SugarColumn(ColumnName = "status", IsNullable = false)]
    public string Status { get; set; } = string.Empty;

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

    /// <summary>
    /// 发起人ID
    /// </summary>
    [SugarColumn(ColumnName = "initiator_id", IsNullable = false)]
    public long InitiatorId { get; set; }

    /// <summary>
    /// 发起人姓名
    /// </summary>
    [SugarColumn(ColumnName = "initiator_name", IsNullable = false)]
    public string InitiatorName { get; set; } = string.Empty;

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

    /// <summary>
    /// 完成时间
    /// </summary>
    [SugarColumn(ColumnName = "finish_time", IsNullable = true)]
    public DateTime? FinishTime { get; set; }
}