package com.mosquito.project.permission;

import jakarta.persistence.*;
import java.time.LocalDateTime;

/**
 * 审批流程配置实体
 */
@Entity
@Table(name = "sys_approval_flow")
public class SysApprovalFlow {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "flow_code", nullable = false, unique = true, length = 50)
    private String flowCode;

    @Column(name = "flow_name", nullable = false, length = 100)
    private String flowName;

    @Column(name = "trigger_event", nullable = false, length = 100)
    private String triggerEvent;

    @Column(name = "conditions", columnDefinition = "JSON")
    private String conditions;

    @Column(name = "nodes", nullable = false, columnDefinition = "JSON")
    private String nodes;

    @Column(name = "timeout_hours")
    private Integer timeoutHours = 24;

    @Column(name = "timeout_action", length = 20)
    private String timeoutAction = "ESCALATE";

    @Column(name = "status", length = 20)
    private String status = "ENABLED";

    @Column(name = "created_at")
    private LocalDateTime createdAt;

    // Getters and Setters
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public String getFlowCode() { return flowCode; }
    public void setFlowCode(String flowCode) { this.flowCode = flowCode; }

    public String getFlowName() { return flowName; }
    public void setFlowName(String flowName) { this.flowName = flowName; }

    public String getTriggerEvent() { return triggerEvent; }
    public void setTriggerEvent(String triggerEvent) { this.triggerEvent = triggerEvent; }

    public String getConditions() { return conditions; }
    public void setConditions(String conditions) { this.conditions = conditions; }

    public String getNodes() { return nodes; }
    public void setNodes(String nodes) { this.nodes = nodes; }

    public Integer getTimeoutHours() { return timeoutHours; }
    public void setTimeoutHours(Integer timeoutHours) { this.timeoutHours = timeoutHours; }

    public String getTimeoutAction() { return timeoutAction; }
    public void setTimeoutAction(String timeoutAction) { this.timeoutAction = timeoutAction; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public LocalDateTime getCreatedAt() { return createdAt; }
    public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}
