package com.easyagents.document.core.entity;

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

/**
 * 统一解析请求。
 *
 * @author Codex
 * @since 2026-04-14
 */
public class ParseRequest {

    private List<ParseFile> files = new ArrayList<ParseFile>();
    private String backend;
    private List<String> languages = new ArrayList<String>();
    private Boolean returnMarkdown = true;
    private Boolean returnMiddleJson = true;
    private Boolean returnContentList = true;
    private Boolean returnModelOutput = false;
    private Boolean returnImages = true;

    /**
     * 追加待解析文件。
     *
     * @param parseFile 文件
     * @return 当前请求
     */
    public ParseRequest addFile(ParseFile parseFile) {
        if (parseFile != null) {
            this.files.add(parseFile);
        }
        return this;
    }

    /**
     * 复制通用字段到目标请求。
     *
     * @param target 目标请求
     */
    public void copyCommonFieldsTo(ParseRequest target) {
        if (target == null) {
            return;
        }
        target.setFiles(new ArrayList<ParseFile>(getFiles()));
        target.setBackend(getBackend());
        target.setLanguages(new ArrayList<String>(getLanguages()));
        target.setReturnMarkdown(getReturnMarkdown());
        target.setReturnMiddleJson(getReturnMiddleJson());
        target.setReturnContentList(getReturnContentList());
        target.setReturnModelOutput(getReturnModelOutput());
        target.setReturnImages(getReturnImages());
    }

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

    public void setFiles(List<ParseFile> files) {
        this.files = files == null ? new ArrayList<ParseFile>() : files;
    }

    public String getBackend() {
        return backend;
    }

    public void setBackend(String backend) {
        this.backend = backend;
    }

    public List<String> getLanguages() {
        return languages;
    }

    public void setLanguages(List<String> languages) {
        this.languages = languages == null ? new ArrayList<String>() : languages;
    }

    public Boolean getReturnMarkdown() {
        return returnMarkdown;
    }

    public void setReturnMarkdown(Boolean returnMarkdown) {
        this.returnMarkdown = returnMarkdown;
    }

    public Boolean getReturnMiddleJson() {
        return returnMiddleJson;
    }

    public void setReturnMiddleJson(Boolean returnMiddleJson) {
        this.returnMiddleJson = returnMiddleJson;
    }

    public Boolean getReturnContentList() {
        return returnContentList;
    }

    public void setReturnContentList(Boolean returnContentList) {
        this.returnContentList = returnContentList;
    }

    public Boolean getReturnModelOutput() {
        return returnModelOutput;
    }

    public void setReturnModelOutput(Boolean returnModelOutput) {
        this.returnModelOutput = returnModelOutput;
    }

    public Boolean getReturnImages() {
        return returnImages;
    }

    public void setReturnImages(Boolean returnImages) {
        this.returnImages = returnImages;
    }
}
