package org.jk.rag.domain.entity;

import org.jk.common.mybatis.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.ArrayList;
import java.util.List;

/**
 * 智谱知识库列表 bm_knowledge
 *
 * @author takai
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class JkKnowledge extends BaseEntity
{
    private static final long serialVersionUID = 1L;


    /** 知识库ID */
    private String knowledgeId;

    /** 知识库绑定的向量化模型 */
    private String embeddingId;

    /** 知识库名称 */
    private String name;

    /** 知识库描述 */
    private String description;

    /**
     * 可见性：'0':公开，'1':私有
     */
    private String visible;

    /** 背景颜色 */
    private String background;

    /** 知识库图标 */
    private String icon;

    /** 知识库总字数 */
    private Integer wordNum;

    /** 知识库总大小（字节） */
    private Integer length;

    /** 知识文件数量 */
    private Integer documentSize;

    /**
     * 查询条件
     */
    private List<String> knowledgeIds = new ArrayList<>();

    private String remark;
    /** 切分规则 */
    private String splittingType;
    /** 知识库图谱 */
    private Boolean knowledgeGraph;

    @Override
    public String toString() {
        return "JkKnowledge{" +
            "knowledgeId='" + knowledgeId + '\'' +
            ", embeddingId='" + embeddingId + '\'' +
            ", name='" + name + '\'' +
            ", description='" + description + '\'' +
            ", visible='" + visible + '\'' +
            ", background='" + background + '\'' +
            ", icon='" + icon + '\'' +
            ", wordNum=" + wordNum +
            ", length=" + length +
            ", documentSize=" + documentSize +
            ", knowledgeIds=" + knowledgeIds +
            ", splittingType='" + splittingType + '\'' +
            ", knowledgeGraph='" + knowledgeGraph + '\'' +
            '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        JkKnowledge that = (JkKnowledge) o;

        return knowledgeId.equals(that.knowledgeId);
    }

    @Override
    public int hashCode() {
        return  knowledgeId.hashCode();
    }
}
