package tech.easyflow.agent.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.handler.FastjsonTypeHandler;
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;

/**
 * Agent 与已发布 Skill 的原子草稿绑定。
 */
@Table("tb_agent_skill_binding")
public class AgentSkillBinding 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 agentId;
    private BigInteger skillId;
    private Integer sortNo;
    private Date created;
    private BigInteger createdBy;
    private Date modified;
    private BigInteger modifiedBy;
    @Column(ignore = true, typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> resourceSnapshot = new LinkedHashMap<>();
    @Column(ignore = true, typeHandler = FastjsonTypeHandler.class)
    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 Agent ID */
    public BigInteger getAgentId() { return agentId; }
    /** @param agentId Agent ID */
    public void setAgentId(BigInteger agentId) { this.agentId = agentId; }
    /** @return Skill ID */
    public BigInteger getSkillId() { return skillId; }
    /** @param skillId Skill ID */
    public void setSkillId(BigInteger skillId) { this.skillId = skillId; }
    /** @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 Agent 内部冻结 Skill 运行快照 */
    public Map<String, Object> getResourceSnapshot() { return resourceSnapshot; }
    /** @param resourceSnapshot Agent 内部冻结 Skill 运行快照 */
    public void setResourceSnapshot(Map<String, Object> resourceSnapshot) {
        this.resourceSnapshot = resourceSnapshot == null ? new LinkedHashMap<>() : resourceSnapshot;
    }
    /** @return 脱敏 Skill 摘要 */
    public Map<String, Object> getResourceSummary() { return resourceSummary; }
    /** @param resourceSummary 脱敏 Skill 摘要 */
    public void setResourceSummary(Map<String, Object> resourceSummary) {
        this.resourceSummary = resourceSummary == null ? new LinkedHashMap<>() : resourceSummary;
    }
}
