package tech.easyflow.ai.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;

/**
 * 知识库文档批量导入批次。
 *
 * @author Codex
 * @since 2026-07-31
 */
@Table(value = "tb_document_import_batch", comment = "知识库文档批量导入批次")
public class DocumentImportBatch extends DateEntity implements Serializable {

    @Id(keyType = KeyType.Generator, value = "snowFlakeId")
    private BigInteger id;

    @Column(comment = "知识库ID")
    private BigInteger knowledgeId;

    @Column(comment = "调用者类型")
    private String callerType;

    @Column(comment = "调用者ID")
    private BigInteger callerId;

    @Column(comment = "幂等键哈希")
    private String idempotencyKeyHash;

    @Column(comment = "请求摘要")
    private String requestDigest;

    @Column(comment = "重复文件策略")
    private String duplicatePolicy;

    @Column(comment = "请求分块策略")
    private String requestedStrategyJson;

    @Column(comment = "重试代次")
    private Integer retryGeneration;

    @Column(comment = "乐观锁版本")
    private Integer version;

    @Column(comment = "导入模式")
    private String importMode;

    @Column(comment = "批次状态")
    private String status;

    @Column(comment = "文件总数")
    private Integer totalCount;

    @Column(comment = "文件总字节数")
    private Long totalBytes;

    @Column(comment = "完成数")
    private Integer completedCount;

    @Column(comment = "处理中数量")
    private Integer processingCount;

    @Column(comment = "失败数")
    private Integer failedCount;

    @Column(comment = "等待数")
    private Integer pendingCount;

    @Column(comment = "已上传数")
    private Integer uploadedCount;

    @Column(comment = "跳过数")
    private Integer skippedCount;

    @Column(comment = "取消数")
    private Integer cancelledCount;

    @Column(comment = "可重试失败数")
    private Integer retryableFailedCount;

    @Column(comment = "中断错误码")
    private String interruptCode;

    @Column(comment = "中断原因")
    private String interruptMessage;

    @Column(comment = "中断时间")
    private Date interruptedAt;

    @Column(comment = "是否存在待恢复调度")
    private Boolean recoveryPending;

    @Column(comment = "待恢复文件键 JSON")
    private String recoveryFileKeysJson;

    @Column(comment = "恢复调度令牌")
    private String recoveryToken;

    @Column(comment = "恢复调度租约到期时间")
    private Date recoveryLeaseUntil;

    @Column(comment = "开始时间")
    private Date startedAt;

    @Column(comment = "结束时间")
    private Date finishedAt;

    @Column(comment = "创建时间")
    private Date created;

    @Column(comment = "创建人")
    private BigInteger createdBy;

    @Column(comment = "修改时间")
    private Date modified;

    @Column(comment = "修改人")
    private BigInteger modifiedBy;

    public BigInteger getId() {
        return id;
    }

    public void setId(BigInteger id) {
        this.id = id;
    }

    public BigInteger getKnowledgeId() {
        return knowledgeId;
    }

    public void setKnowledgeId(BigInteger knowledgeId) {
        this.knowledgeId = knowledgeId;
    }

    public String getCallerType() {
        return callerType;
    }

    public void setCallerType(String callerType) {
        this.callerType = callerType;
    }

    public BigInteger getCallerId() {
        return callerId;
    }

    public void setCallerId(BigInteger callerId) {
        this.callerId = callerId;
    }

    public String getIdempotencyKeyHash() {
        return idempotencyKeyHash;
    }

    public void setIdempotencyKeyHash(String idempotencyKeyHash) {
        this.idempotencyKeyHash = idempotencyKeyHash;
    }

    public String getRequestDigest() {
        return requestDigest;
    }

    public void setRequestDigest(String requestDigest) {
        this.requestDigest = requestDigest;
    }

    public String getDuplicatePolicy() {
        return duplicatePolicy;
    }

    public void setDuplicatePolicy(String duplicatePolicy) {
        this.duplicatePolicy = duplicatePolicy;
    }

    public String getRequestedStrategyJson() {
        return requestedStrategyJson;
    }

    public void setRequestedStrategyJson(String requestedStrategyJson) {
        this.requestedStrategyJson = requestedStrategyJson;
    }

    public Integer getRetryGeneration() {
        return retryGeneration;
    }

    public void setRetryGeneration(Integer retryGeneration) {
        this.retryGeneration = retryGeneration;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getImportMode() {
        return importMode;
    }

    public void setImportMode(String importMode) {
        this.importMode = importMode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Long getTotalBytes() {
        return totalBytes;
    }

    public void setTotalBytes(Long totalBytes) {
        this.totalBytes = totalBytes;
    }

    public Integer getCompletedCount() {
        return completedCount;
    }

    public void setCompletedCount(Integer completedCount) {
        this.completedCount = completedCount;
    }

    public Integer getProcessingCount() {
        return processingCount;
    }

    public void setProcessingCount(Integer processingCount) {
        this.processingCount = processingCount;
    }

    public Integer getFailedCount() {
        return failedCount;
    }

    public void setFailedCount(Integer failedCount) {
        this.failedCount = failedCount;
    }

    public Integer getPendingCount() {
        return pendingCount;
    }

    public void setPendingCount(Integer pendingCount) {
        this.pendingCount = pendingCount;
    }

    public Integer getUploadedCount() {
        return uploadedCount;
    }

    public void setUploadedCount(Integer uploadedCount) {
        this.uploadedCount = uploadedCount;
    }

    public Integer getSkippedCount() {
        return skippedCount;
    }

    public void setSkippedCount(Integer skippedCount) {
        this.skippedCount = skippedCount;
    }

    public Integer getCancelledCount() {
        return cancelledCount;
    }

    public void setCancelledCount(Integer cancelledCount) {
        this.cancelledCount = cancelledCount;
    }

    public Integer getRetryableFailedCount() {
        return retryableFailedCount;
    }

    public void setRetryableFailedCount(Integer retryableFailedCount) {
        this.retryableFailedCount = retryableFailedCount;
    }

    public String getInterruptCode() {
        return interruptCode;
    }

    public void setInterruptCode(String interruptCode) {
        this.interruptCode = interruptCode;
    }

    public String getInterruptMessage() {
        return interruptMessage;
    }

    public void setInterruptMessage(String interruptMessage) {
        this.interruptMessage = interruptMessage;
    }

    public Date getInterruptedAt() {
        return interruptedAt;
    }

    public void setInterruptedAt(Date interruptedAt) {
        this.interruptedAt = interruptedAt;
    }

    public Boolean getRecoveryPending() {
        return recoveryPending;
    }

    public void setRecoveryPending(Boolean recoveryPending) {
        this.recoveryPending = recoveryPending;
    }

    public String getRecoveryFileKeysJson() {
        return recoveryFileKeysJson;
    }

    public void setRecoveryFileKeysJson(String recoveryFileKeysJson) {
        this.recoveryFileKeysJson = recoveryFileKeysJson;
    }

    public String getRecoveryToken() {
        return recoveryToken;
    }

    public void setRecoveryToken(String recoveryToken) {
        this.recoveryToken = recoveryToken;
    }

    public Date getRecoveryLeaseUntil() {
        return recoveryLeaseUntil;
    }

    public void setRecoveryLeaseUntil(Date recoveryLeaseUntil) {
        this.recoveryLeaseUntil = recoveryLeaseUntil;
    }

    public Date getStartedAt() {
        return startedAt;
    }

    public void setStartedAt(Date startedAt) {
        this.startedAt = startedAt;
    }

    public Date getFinishedAt() {
        return finishedAt;
    }

    public void setFinishedAt(Date finishedAt) {
        this.finishedAt = finishedAt;
    }

    @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;
    }
}
