package tech.easyflow.skill.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import tech.easyflow.common.entity.DateEntity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Skill 平台 Tool 草稿绑定。
 *
 * <p>该表只保存资源引用、调用前确认和 MCP 有界摘要；运行名、资源快照与 MCP Tool
 * 明细仅在发布时生成。</p>
 */
@Table("tb_skill_tool_binding")
public class SkillToolBinding extends DateEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Generator, value = "snowFlakeId")
    private BigInteger id;
    @Column(tenantId = true)
    private BigInteger tenantId;
    private BigInteger skillId;
    private String toolType;
    private BigInteger targetId;
    private Boolean hitlEnabled;
    private Integer mcpToolCount;
    private String mcpToolManifestHash;
    private Integer sortNo;
    private Date created;
    private BigInteger createdBy;
    private Date modified;
    private BigInteger modifiedBy;
    @Column(ignore = true)
    private Map<String, Object> resourceSummary = new LinkedHashMap<>();

    /** @return 绑定 ID */
    public BigInteger getId() { return id; }
    /** @param id 绑定 ID */
    public void setId(BigInteger id) { this.id = id; }
    /** @return 租户 ID */
    public BigInteger getTenantId() { return tenantId; }
    /** @param tenantId 租户 ID */
    public void setTenantId(BigInteger tenantId) { this.tenantId = tenantId; }
    /** @return Skill ID */
    public BigInteger getSkillId() { return skillId; }
    /** @param skillId Skill ID */
    public void setSkillId(BigInteger skillId) { this.skillId = skillId; }
    /** @return Tool 类型 */
    public String getToolType() { return toolType; }
    /** @param toolType Tool 类型 */
    public void setToolType(String toolType) { this.toolType = toolType; }
    /** @return 目标资源 ID */
    public BigInteger getTargetId() { return targetId; }
    /** @param targetId 目标资源 ID */
    public void setTargetId(BigInteger targetId) { this.targetId = targetId; }
    /** @return 是否调用前确认 */
    public Boolean getHitlEnabled() { return hitlEnabled; }
    /** @param hitlEnabled 是否调用前确认 */
    public void setHitlEnabled(Boolean hitlEnabled) { this.hitlEnabled = hitlEnabled; }
    /** @return MCP Tool 数量 */
    public Integer getMcpToolCount() { return mcpToolCount; }
    /** @param mcpToolCount MCP Tool 数量 */
    public void setMcpToolCount(Integer mcpToolCount) { this.mcpToolCount = mcpToolCount; }
    /** @return MCP Tool manifest hash */
    public String getMcpToolManifestHash() { return mcpToolManifestHash; }
    /** @param mcpToolManifestHash MCP Tool manifest hash */
    public void setMcpToolManifestHash(String mcpToolManifestHash) { this.mcpToolManifestHash = mcpToolManifestHash; }
    /** @return 排序号 */
    public Integer getSortNo() { return sortNo; }
    /** @param sortNo 排序号 */
    public void setSortNo(Integer sortNo) { this.sortNo = sortNo; }
    /** @return 创建时间 */
    @Override public Date getCreated() { return created; }
    /** @param created 创建时间 */
    @Override public void setCreated(Date created) { this.created = created; }
    /** @return 创建人 */
    public BigInteger getCreatedBy() { return createdBy; }
    /** @param createdBy 创建人 */
    public void setCreatedBy(BigInteger createdBy) { this.createdBy = createdBy; }
    /** @return 修改时间 */
    @Override public Date getModified() { return modified; }
    /** @param modified 修改时间 */
    @Override public void setModified(Date modified) { this.modified = modified; }
    /** @return 修改人 */
    public BigInteger getModifiedBy() { return modifiedBy; }
    /** @param modifiedBy 修改人 */
    public void setModifiedBy(BigInteger modifiedBy) { this.modifiedBy = modifiedBy; }
    /** @return 脱敏资源摘要 */
    public Map<String, Object> getResourceSummary() { return resourceSummary; }
    /** @param resourceSummary 脱敏资源摘要 */
    public void setResourceSummary(Map<String, Object> resourceSummary) {
        this.resourceSummary = resourceSummary == null ? new LinkedHashMap<>() : resourceSummary;
    }
}
