namespace OpenAuth.Repository.Domain.workflow;

using SqlSugar;
using System;

/// <summary>
/// 流程节点表（zy_flow_node）
/// </summary>
[SugarTable("zy_flow_node")]
public class ZyFlowNode
{
    /// <summary>
    /// 节点ID（主键，自增）
    /// </summary>
    [SugarColumn(ColumnName = "node_id", IsPrimaryKey = true, IsIdentity = true, IsNullable = false)]
    public long NodeId { get; set; }

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

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

    /// <summary>
    /// 节点类型（Start/Common/Parallel/Branch/End）
    /// </summary>
    [SugarColumn(ColumnName = "node_type", IsNullable = false)]
    public string NodeType { get; set; } = string.Empty;

    /// <summary>
    /// 角色ID
    /// </summary>
    [SugarColumn(ColumnName = "role_id", IsNullable = false)]
    public long RoleId { get; set; }

    /// <summary>
    /// 下一节点IDs（逗号分隔）
    /// </summary>
    [SugarColumn(ColumnName = "next_node_ids", IsNullable = true)]
    public string? NextNodeIds { get; set; }

    /// <summary>
    /// 是否可回退（默认true）
    /// </summary>
    [SugarColumn(ColumnName = "is_backable", IsNullable = true)]
    public bool? IsBackable { get; set; } = true;

    /// <summary>
    /// 排序号（默认0）
    /// </summary>
    [SugarColumn(ColumnName = "sort_no", IsNullable = true)]
    public int? SortNo { get; set; } = 0;
}