package com.easyagents.document.core.entity;

/**
 * PDF 解析请求。
 *
 * @author Codex
 * @since 2026-04-16
 */
public class PdfParseRequest extends ParseRequest {

    private String parseMethod = "auto";
    private Boolean formulaEnabled = true;
    private Boolean tableEnabled = true;
    private Integer startPageIndex = 0;
    private Integer endPageIndex = 99999;

    /**
     * 将通用请求转换为 PDF 请求。
     *
     * @param request 原始请求
     * @return PDF 请求
     */
    public static PdfParseRequest from(ParseRequest request) {
        PdfParseRequest pdfParseRequest = new PdfParseRequest();
        if (request == null) {
            return pdfParseRequest;
        }
        request.copyCommonFieldsTo(pdfParseRequest);
        if (request instanceof PdfParseRequest) {
            PdfParseRequest source = (PdfParseRequest) request;
            pdfParseRequest.setParseMethod(source.getParseMethod());
            pdfParseRequest.setFormulaEnabled(source.getFormulaEnabled());
            pdfParseRequest.setTableEnabled(source.getTableEnabled());
            pdfParseRequest.setStartPageIndex(source.getStartPageIndex());
            pdfParseRequest.setEndPageIndex(source.getEndPageIndex());
        }
        return pdfParseRequest;
    }

    public String getParseMethod() {
        return parseMethod;
    }

    public void setParseMethod(String parseMethod) {
        this.parseMethod = parseMethod;
    }

    public Boolean getFormulaEnabled() {
        return formulaEnabled;
    }

    public void setFormulaEnabled(Boolean formulaEnabled) {
        this.formulaEnabled = formulaEnabled;
    }

    public Boolean getTableEnabled() {
        return tableEnabled;
    }

    public void setTableEnabled(Boolean tableEnabled) {
        this.tableEnabled = tableEnabled;
    }

    public Integer getStartPageIndex() {
        return startPageIndex;
    }

    public void setStartPageIndex(Integer startPageIndex) {
        this.startPageIndex = startPageIndex;
    }

    public Integer getEndPageIndex() {
        return endPageIndex;
    }

    public void setEndPageIndex(Integer endPageIndex) {
        this.endPageIndex = endPageIndex;
    }
}
