package com.easyagents.document.core.entity;

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

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

    private List<String> sheetNames = new ArrayList<String>();
    private Boolean includeHiddenSheets = false;
    private Boolean ocrEmbeddedImages = true;
    private Integer maxRowsPerSheet;
    private Boolean includeImageAppendix = true;

    /**
     * 将通用请求转换为 XLSX 请求。
     *
     * @param request 原始请求
     * @return XLSX 请求
     */
    public static XlsxParseRequest from(ParseRequest request) {
        XlsxParseRequest xlsxParseRequest = new XlsxParseRequest();
        if (request == null) {
            return xlsxParseRequest;
        }
        request.copyCommonFieldsTo(xlsxParseRequest);
        if (request instanceof XlsxParseRequest) {
            XlsxParseRequest source = (XlsxParseRequest) request;
            xlsxParseRequest.setSheetNames(new ArrayList<String>(source.getSheetNames()));
            xlsxParseRequest.setIncludeHiddenSheets(source.getIncludeHiddenSheets());
            xlsxParseRequest.setOcrEmbeddedImages(source.getOcrEmbeddedImages());
            xlsxParseRequest.setMaxRowsPerSheet(source.getMaxRowsPerSheet());
            xlsxParseRequest.setIncludeImageAppendix(source.getIncludeImageAppendix());
        }
        return xlsxParseRequest;
    }

    public List<String> getSheetNames() {
        return sheetNames;
    }

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

    public Boolean getIncludeHiddenSheets() {
        return includeHiddenSheets;
    }

    public void setIncludeHiddenSheets(Boolean includeHiddenSheets) {
        this.includeHiddenSheets = includeHiddenSheets;
    }

    public Boolean getOcrEmbeddedImages() {
        return ocrEmbeddedImages;
    }

    public void setOcrEmbeddedImages(Boolean ocrEmbeddedImages) {
        this.ocrEmbeddedImages = ocrEmbeddedImages;
    }

    public Integer getMaxRowsPerSheet() {
        return maxRowsPerSheet;
    }

    public void setMaxRowsPerSheet(Integer maxRowsPerSheet) {
        this.maxRowsPerSheet = maxRowsPerSheet;
    }

    public Boolean getIncludeImageAppendix() {
        return includeImageAppendix;
    }

    public void setIncludeImageAppendix(Boolean includeImageAppendix) {
        this.includeImageAppendix = includeImageAppendix;
    }
}
