package com.mosquito.project.persistence.entity;

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

/**
 * 风控规则实体
 */
@Entity
@Table(name = "risk_rules")
public class RiskRuleEntity {

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

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

    @Column(name = "risk_type", nullable = false, length = 50)
    private String riskType;

    @Column(name = "condition_expr", nullable = false, columnDefinition = "TEXT")
    private String conditionExpr;

    @Column(nullable = false, length = 50)
    private String action;

    @Column(name = "action_params", columnDefinition = "TEXT")
    private String actionParams;

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

    @Column(nullable = false)
    private Integer priority = 0;

    @Column(name = "created_by")
    private Long createdBy;

    @Column(name = "department_id")
    private Long departmentId;

    @Column(name = "created_at", nullable = false)
    private OffsetDateTime createdAt;

    @Column(name = "updated_at", nullable = false)
    private OffsetDateTime updatedAt;

    @Column(name = "deleted_at")
    private OffsetDateTime deletedAt;

    // 待审批的更新内容（JSON格式）
    @Column(name = "pending_update", columnDefinition = "TEXT")
    private String pendingUpdate;

    // Getters and Setters
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getRiskType() { return riskType; }
    public void setRiskType(String riskType) { this.riskType = riskType; }
    public String getConditionExpr() { return conditionExpr; }
    public void setConditionExpr(String conditionExpr) { this.conditionExpr = conditionExpr; }
    public String getAction() { return action; }
    public void setAction(String action) { this.action = action; }
    public String getActionParams() { return actionParams; }
    public void setActionParams(String actionParams) { this.actionParams = actionParams; }
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    public Integer getPriority() { return priority; }
    public void setPriority(Integer priority) { this.priority = priority; }
    public Long getCreatedBy() { return createdBy; }
    public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; }
    public Long getDepartmentId() { return departmentId; }
    public void setDepartmentId(Long departmentId) { this.departmentId = departmentId; }
    public OffsetDateTime getCreatedAt() { return createdAt; }
    public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; }
    public OffsetDateTime getUpdatedAt() { return updatedAt; }
    public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; }
    public OffsetDateTime getDeletedAt() { return deletedAt; }
    public void setDeletedAt(OffsetDateTime deletedAt) { this.deletedAt = deletedAt; }
    public String getPendingUpdate() { return pendingUpdate; }
    public void setPendingUpdate(String pendingUpdate) { this.pendingUpdate = pendingUpdate; }
}
