package com.gzzm.lobster.tool;

import com.gzzm.lobster.common.ToolCategory;
import com.gzzm.lobster.common.ToolExecutionMode;
import com.gzzm.lobster.common.ToolRiskLevel;
import net.cyan.thunwind.annotation.ColumnDescription;
import net.cyan.thunwind.annotation.Entity;
import net.cyan.thunwind.annotation.Index;

import java.util.Date;

/**
 * ToolDefinitionConfig —— 工具定义数据库镜像 / DB-persisted tool definition.
 *
 * <p>用于记录可用工具、启停、风险等级、权限策略。
 * 工具的执行器仍由 Java 代码实现（通过 ToolRegistry 按 toolName 绑定），
 * 本表只管治理面。
 * Governance mirror of built-in and MCP tools.
 */
@Entity(table = "AI_TOOL_DEFINITION", keys = "toolName")
public class ToolDefinitionConfig {

    @ColumnDescription(type = "varchar(220)")
    private String toolName;

    @ColumnDescription(type = "varchar(200)")
    private String displayName;

    @ColumnDescription(type = "varchar(4000)")
    private String description;

    @Index
    private ToolCategory category;

    private ToolExecutionMode mode;

    private ToolRiskLevel riskLevel;

    @ColumnDescription(type = "number(1)", defaultValue = "0")
    private Boolean requireConfirm;

    @ColumnDescription(type = "varchar(40)")
    private String mcpServerId;

    @ColumnDescription(type = "number(1)", defaultValue = "1")
    private Boolean enabled;

    @ColumnDescription(type = "varchar(40)")
    private String orgId;

    private Date createTime;
    private Date updateTime;

    public ToolDefinitionConfig() {}

    public String getToolName() { return toolName; }
    public void setToolName(String toolName) { this.toolName = toolName; }
    public String getDisplayName() { return displayName; }
    public void setDisplayName(String displayName) { this.displayName = displayName; }
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    public ToolCategory getCategory() { return category; }
    public void setCategory(ToolCategory category) { this.category = category; }
    public ToolExecutionMode getMode() { return mode; }
    public void setMode(ToolExecutionMode mode) { this.mode = mode; }
    public ToolRiskLevel getRiskLevel() { return riskLevel; }
    public void setRiskLevel(ToolRiskLevel riskLevel) { this.riskLevel = riskLevel; }
    public Boolean getRequireConfirm() { return requireConfirm; }
    public void setRequireConfirm(Boolean requireConfirm) { this.requireConfirm = requireConfirm; }
    public String getMcpServerId() { return mcpServerId; }
    public void setMcpServerId(String mcpServerId) { this.mcpServerId = mcpServerId; }
    public Boolean getEnabled() { return enabled; }
    public void setEnabled(Boolean enabled) { this.enabled = enabled; }
    public String getOrgId() { return orgId; }
    public void setOrgId(String orgId) { this.orgId = orgId; }
    public Date getCreateTime() { return createTime; }
    public void setCreateTime(Date createTime) { this.createTime = createTime; }
    public Date getUpdateTime() { return updateTime; }
    public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
}
