package tech.easyflow.ai.entity;

import tech.easyflow.ai.entity.base.DocumentBase;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;

import java.math.BigInteger;

/**
 *  实体类。
 *
 * @author michael
 * @since 2024-08-23
 */

@Table("tb_document")
public class Document extends DocumentBase {

    // 每条document对应的有多少条documentChunk分段
    @Column(ignore = true)
   private BigInteger chunkCount;

    /**
     * 分块最大长度
     */
    @Column(ignore = true)
    private int chunkSize;

    /**
     *  分块之间的重叠长度
     */
    @Column(ignore = true)
    private int overlapSize;

    public BigInteger getChunkCount() {
        return chunkCount;
    }

    public void setChunkCount(BigInteger chunkCount) {
        this.chunkCount = chunkCount;
    }

    public int getChunkSize() {
        return chunkSize;
    }

    public void setChunkSize(int chunkSize) {
        this.chunkSize = chunkSize;
    }

    public int getOverlapSize() {
        return overlapSize;
    }

    public void setOverlapSize(int overlapSize) {
        this.overlapSize = overlapSize;
    }

    /**
     * 获取列表展示时的优先分块数。
     *
     * @return 分块数
     */
    public long getDisplayChunkCount() {
        if (getTotalChunks() != null && getTotalChunks() > 0) {
            return getTotalChunks();
        }
        return chunkCount == null ? 0L : chunkCount.longValue();
    }
}
