package tech.easyflow.ai.documentimport;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 文档批量导入接口数据对象。
 *
 * @author Codex
 * @since 2026-07-31
 */
public final class DocumentImportBatchDtos {

    private DocumentImportBatchDtos() {
    }

    /**
     * 客户端文件清单项。
     */
    public static class ManifestItem implements Serializable {
        private String clientFileKey;
        private String fileName;
        private String relativePath;
        private Long fileSize;

        public String getClientFileKey() {
            return clientFileKey;
        }

        public void setClientFileKey(String clientFileKey) {
            this.clientFileKey = clientFileKey;
        }

        public String getFileName() {
            return fileName;
        }

        public void setFileName(String fileName) {
            this.fileName = fileName;
        }

        public String getRelativePath() {
            return relativePath;
        }

        public void setRelativePath(String relativePath) {
            this.relativePath = relativePath;
        }

        public Long getFileSize() {
            return fileSize;
        }

        public void setFileSize(Long fileSize) {
            this.fileSize = fileSize;
        }
    }

    /**
     * 创建批次请求。
     */
    public static class CreateRequest implements Serializable {
        private BigInteger knowledgeId;
        private List<ManifestItem> files = new ArrayList<ManifestItem>();

        public BigInteger getKnowledgeId() {
            return knowledgeId;
        }

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

        public List<ManifestItem> getFiles() {
            return files;
        }

        public void setFiles(List<ManifestItem> files) {
            this.files = files;
        }
    }

    /**
     * 服务端文件项。
     */
    public static class ItemResponse implements Serializable {
        private BigInteger itemId;
        private BigInteger documentId;
        private String clientFileKey;
        private String fileName;
        private String relativePath;
        private Long fileSize;
        private String stage;
        private String status;
        private String errorSummary;

        public BigInteger getItemId() {
            return itemId;
        }

        public void setItemId(BigInteger itemId) {
            this.itemId = itemId;
        }

        public BigInteger getDocumentId() {
            return documentId;
        }

        public void setDocumentId(BigInteger documentId) {
            this.documentId = documentId;
        }

        public String getClientFileKey() {
            return clientFileKey;
        }

        public void setClientFileKey(String clientFileKey) {
            this.clientFileKey = clientFileKey;
        }

        public String getFileName() {
            return fileName;
        }

        public void setFileName(String fileName) {
            this.fileName = fileName;
        }

        public String getRelativePath() {
            return relativePath;
        }

        public void setRelativePath(String relativePath) {
            this.relativePath = relativePath;
        }

        public Long getFileSize() {
            return fileSize;
        }

        public void setFileSize(Long fileSize) {
            this.fileSize = fileSize;
        }

        public String getStage() {
            return stage;
        }

        public void setStage(String stage) {
            this.stage = stage;
        }

        public String getStatus() {
            return status;
        }

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

        public String getErrorSummary() {
            return errorSummary;
        }

        public void setErrorSummary(String errorSummary) {
            this.errorSummary = errorSummary;
        }
    }

    /**
     * 创建批次响应。
     */
    public static class CreateResponse implements Serializable {
        private BigInteger batchId;
        private Integer uploadConcurrency;
        private List<ItemResponse> items = new ArrayList<ItemResponse>();

        public BigInteger getBatchId() {
            return batchId;
        }

        public void setBatchId(BigInteger batchId) {
            this.batchId = batchId;
        }

        public Integer getUploadConcurrency() {
            return uploadConcurrency;
        }

        public void setUploadConcurrency(Integer uploadConcurrency) {
            this.uploadConcurrency = uploadConcurrency;
        }

        public List<ItemResponse> getItems() {
            return items;
        }

        public void setItems(List<ItemResponse> items) {
            this.items = items;
        }
    }

    /**
     * 启动批次请求。
     */
    public static class StartRequest implements Serializable {
        private BigInteger knowledgeId;
        private BigInteger batchId;
        private String importMode;
        private String duplicatePolicy;

        public BigInteger getKnowledgeId() {
            return knowledgeId;
        }

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

        public BigInteger getBatchId() {
            return batchId;
        }

        public void setBatchId(BigInteger batchId) {
            this.batchId = batchId;
        }

        public String getImportMode() {
            return importMode;
        }

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

        public String getDuplicatePolicy() {
            return duplicatePolicy;
        }

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

    /**
     * 批次状态响应。
     */
    public static class StatusResponse implements Serializable {
        private BigInteger batchId;
        private String importMode;
        private String status;
        private Boolean actualCompleted;
        private Integer totalCount;
        private Long totalBytes;
        private Integer completedCount;
        private Integer processingCount;
        private Integer failedCount;
        private Integer pendingCount;
        private Integer skippedCount;
        private Integer cancelledCount;
        private Integer retryableFailedCount;
        private Integer progressPercent;
        private String interruptCode;
        private String interruptMessage;
        private Date interruptedAt;
        private Date startedAt;
        private Date finishedAt;

        public BigInteger getBatchId() {
            return batchId;
        }

        public void setBatchId(BigInteger batchId) {
            this.batchId = batchId;
        }

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

        /**
         * 获取批次关联任务是否已经按真实文档状态全部完成。
         *
         * @return 全部完成时返回 {@code true}
         */
        public Boolean getActualCompleted() {
            return actualCompleted;
        }

        /**
         * 设置批次关联任务是否已经按真实文档状态全部完成。
         *
         * @param actualCompleted 是否全部完成
         */
        public void setActualCompleted(Boolean actualCompleted) {
            this.actualCompleted = actualCompleted;
        }

        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 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 Integer getProgressPercent() {
            return progressPercent;
        }

        public void setProgressPercent(Integer progressPercent) {
            this.progressPercent = progressPercent;
        }

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