package com.mosquito.project.permission;

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

/**
 * 审批记录实体
 */
@Entity
@Table(name = "sys_approval_record")
public class SysApprovalRecord {

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

    @Column(name = "flow_id", nullable = false)
    private Long flowId;

    @Column(name = "biz_type", nullable = false, length = 50)
    private String bizType;

    @Column(name = "biz_id", nullable = false)
    private Long bizId;

    @Column(name = "current_node", nullable = false)
    private Integer currentNode = 0;

    @Column(name = "applicant_id", nullable = false)
    private Long applicantId;

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

    @Column(name = "current_approver_id")
    private Long currentApproverId;

    // 并行/会签支持字段
    @Column(name = "approver_ids", length = 500)
    private String approverIds; // JSON数组格式

    @Column(name = "approved_count")
    private Integer approvedCount = 0;

    @Column(name = "rejected_count")
    private Integer rejectedCount = 0;

    @Column(name = "required_approvals")
    private Integer requiredApprovals = 1;

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

    @Column(name = "updated_at")
    private LocalDateTime updatedAt;

    // 业务扩展数据（JSON格式，存储业务相关的额外信息）
    @Column(name = "biz_data", length = 2000)
    private String bizData;

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

    public Long getFlowId() { return flowId; }
    public void setFlowId(Long flowId) { this.flowId = flowId; }

    public String getBizType() { return bizType; }
    public void setBizType(String bizType) { this.bizType = bizType; }

    public Long getBizId() { return bizId; }
    public void setBizId(Long bizId) { this.bizId = bizId; }

    public Integer getCurrentNode() { return currentNode; }
    public void setCurrentNode(Integer currentNode) { this.currentNode = currentNode; }

    public Long getApplicantId() { return applicantId; }
    public void setApplicantId(Long applicantId) { this.applicantId = applicantId; }

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

    public Long getCurrentApproverId() { return currentApproverId; }
    public void setCurrentApproverId(Long currentApproverId) { this.currentApproverId = currentApproverId; }

    public String getApproverIds() { return approverIds; }
    public void setApproverIds(String approverIds) { this.approverIds = approverIds; }

    public Integer getApprovedCount() { return approvedCount; }
    public void setApprovedCount(Integer approvedCount) { this.approvedCount = approvedCount; }

    public Integer getRejectedCount() { return rejectedCount; }
    public void setRejectedCount(Integer rejectedCount) { this.rejectedCount = rejectedCount; }

    public Integer getRequiredApprovals() { return requiredApprovals; }
    public void setRequiredApprovals(Integer requiredApprovals) { this.requiredApprovals = requiredApprovals; }

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

    public LocalDateTime getUpdatedAt() { return updatedAt; }
    public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }

    public String getBizData() { return bizData; }
    public void setBizData(String bizData) { this.bizData = bizData; }
}
