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 tech.easyflow.system.permission.resource.VisibilityResource;

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

/**
 * Agent 主实体。
 */
@Table("tb_agent")
public class Agent extends DateEntity implements VisibilityResource, Serializable {

    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Generator, value = "snowFlakeId")
    private BigInteger id;
    @Column(tenantId = true)
    private BigInteger tenantId;
    private BigInteger deptId;
    private String name;
    private String description;
    private String avatar;
    private BigInteger categoryId;
    private BigInteger modelId;
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> modelConfigJson = new LinkedHashMap<>();
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> generationConfigJson = new LinkedHashMap<>();
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> promptConfigJson = new LinkedHashMap<>();
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> memoryConfigJson = new LinkedHashMap<>();
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> executionConfigJson = new LinkedHashMap<>();
    /** 对话欢迎语、猜你想问和输入提示配置。 */
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> interactionConfigJson = new LinkedHashMap<>();
    private Integer status;
    private String visibilityScope;
    private String publishStatus;
    private BigInteger currentApprovalInstanceId;
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> publishedSnapshotJson = new LinkedHashMap<>();
    private Date publishedAt;
    private BigInteger publishedBy;
    private Date created;
    private BigInteger createdBy;
    private Date modified;
    private BigInteger modifiedBy;

    @Column(ignore = true)
    private Boolean approvalPending;
    @Column(ignore = true)
    private String currentApprovalActionType;
    @Column(ignore = true)
    private String displayPublishStatus;
    @Column(ignore = true)
    private String createdByName;
    @Column(ignore = true)
    private List<AgentToolBinding> toolBindings;
    @Column(ignore = true)
    private List<AgentKnowledgeBinding> knowledgeBindings;

    public BigInteger getId() { return id; }
    public void setId(BigInteger id) { this.id = id; }
    public BigInteger getTenantId() { return tenantId; }
    public void setTenantId(BigInteger tenantId) { this.tenantId = tenantId; }
    public BigInteger getDeptId() { return deptId; }
    public void setDeptId(BigInteger deptId) { this.deptId = deptId; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    public String getAvatar() { return avatar; }
    public void setAvatar(String avatar) { this.avatar = avatar; }
    public BigInteger getCategoryId() { return categoryId; }
    public void setCategoryId(BigInteger categoryId) { this.categoryId = categoryId; }
    public BigInteger getModelId() { return modelId; }
    public void setModelId(BigInteger modelId) { this.modelId = modelId; }
    public Map<String, Object> getModelConfigJson() { return modelConfigJson; }
    public void setModelConfigJson(Map<String, Object> modelConfigJson) { this.modelConfigJson = modelConfigJson == null ? new LinkedHashMap<>() : modelConfigJson; }
    public Map<String, Object> getGenerationConfigJson() { return generationConfigJson; }
    public void setGenerationConfigJson(Map<String, Object> generationConfigJson) { this.generationConfigJson = generationConfigJson == null ? new LinkedHashMap<>() : generationConfigJson; }
    public Map<String, Object> getPromptConfigJson() { return promptConfigJson; }
    public void setPromptConfigJson(Map<String, Object> promptConfigJson) { this.promptConfigJson = promptConfigJson == null ? new LinkedHashMap<>() : promptConfigJson; }
    public Map<String, Object> getMemoryConfigJson() { return memoryConfigJson; }
    public void setMemoryConfigJson(Map<String, Object> memoryConfigJson) { this.memoryConfigJson = memoryConfigJson == null ? new LinkedHashMap<>() : memoryConfigJson; }
    public Map<String, Object> getExecutionConfigJson() { return executionConfigJson; }
    public void setExecutionConfigJson(Map<String, Object> executionConfigJson) { this.executionConfigJson = executionConfigJson == null ? new LinkedHashMap<>() : executionConfigJson; }
    /**
     * 获取对话体验配置。
     *
     * @return 对话体验配置
     */
    public Map<String, Object> getInteractionConfigJson() { return interactionConfigJson; }
    /**
     * 设置对话体验配置。
     *
     * @param interactionConfigJson 对话体验配置
     */
    public void setInteractionConfigJson(Map<String, Object> interactionConfigJson) { this.interactionConfigJson = interactionConfigJson == null ? new LinkedHashMap<>() : interactionConfigJson; }
    public Integer getStatus() { return status; }
    public void setStatus(Integer status) { this.status = status; }
    public String getVisibilityScope() { return visibilityScope; }
    public void setVisibilityScope(String visibilityScope) { this.visibilityScope = visibilityScope; }
    public String getPublishStatus() { return publishStatus; }
    public void setPublishStatus(String publishStatus) { this.publishStatus = publishStatus; }
    public BigInteger getCurrentApprovalInstanceId() { return currentApprovalInstanceId; }
    public void setCurrentApprovalInstanceId(BigInteger currentApprovalInstanceId) { this.currentApprovalInstanceId = currentApprovalInstanceId; }
    public Map<String, Object> getPublishedSnapshotJson() { return publishedSnapshotJson; }
    public void setPublishedSnapshotJson(Map<String, Object> publishedSnapshotJson) { this.publishedSnapshotJson = publishedSnapshotJson == null ? new LinkedHashMap<>() : publishedSnapshotJson; }
    public Date getPublishedAt() { return publishedAt; }
    public void setPublishedAt(Date publishedAt) { this.publishedAt = publishedAt; }
    public BigInteger getPublishedBy() { return publishedBy; }
    public void setPublishedBy(BigInteger publishedBy) { this.publishedBy = publishedBy; }
    @Override public Date getCreated() { return created; }
    @Override public void setCreated(Date created) { this.created = created; }
    public BigInteger getCreatedBy() { return createdBy; }
    public void setCreatedBy(BigInteger createdBy) { this.createdBy = createdBy; }
    @Override public Date getModified() { return modified; }
    @Override public void setModified(Date modified) { this.modified = modified; }
    public BigInteger getModifiedBy() { return modifiedBy; }
    public void setModifiedBy(BigInteger modifiedBy) { this.modifiedBy = modifiedBy; }
    public Boolean getApprovalPending() { return approvalPending; }
    public void setApprovalPending(Boolean approvalPending) { this.approvalPending = approvalPending; }
    public String getCurrentApprovalActionType() { return currentApprovalActionType; }
    public void setCurrentApprovalActionType(String currentApprovalActionType) { this.currentApprovalActionType = currentApprovalActionType; }
    public String getDisplayPublishStatus() { return displayPublishStatus; }
    public void setDisplayPublishStatus(String displayPublishStatus) { this.displayPublishStatus = displayPublishStatus; }
    public String getCreatedByName() { return createdByName; }
    public void setCreatedByName(String createdByName) { this.createdByName = createdByName; }
    public List<AgentToolBinding> getToolBindings() { return toolBindings; }
    public void setToolBindings(List<AgentToolBinding> toolBindings) { this.toolBindings = toolBindings; }
    public List<AgentKnowledgeBinding> getKnowledgeBindings() { return knowledgeBindings; }
    public void setKnowledgeBindings(List<AgentKnowledgeBinding> knowledgeBindings) { this.knowledgeBindings = knowledgeBindings; }
}
