package com.lingyue.extract.dto.config;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * OCR提取配置
 * 
 * 用于 extractType = "ocr" 的规则
 * 使用OCR识别图片中的文字
 * 
 * @author lingyue
 * @since 2026-01-22
 */
@Data
@Schema(description = "OCR提取配置")
public class OcrExtractConfig {
    
    @Schema(description = "OCR引擎: paddleocr-飞桨OCR, tesseract-Tesseract")
    private String ocrEngine;
    
    @Schema(description = "识别语言: chi_sim-简体中文, eng-英文")
    private String language;
    
    @Schema(description = "是否进行表格识别")
    private Boolean detectTable;
    
    @Schema(description = "是否进行版面分析")
    private Boolean layoutAnalysis;
    
    @Schema(description = "图片预处理选项")
    private PreprocessOptions preprocessOptions;
    
    /**
     * 图片预处理选项
     */
    @Data
    @Schema(description = "图片预处理选项")
    public static class PreprocessOptions {
        
        @Schema(description = "是否转为灰度图")
        private Boolean grayscale;
        
        @Schema(description = "是否进行二值化")
        private Boolean binarize;
        
        @Schema(description = "是否去噪")
        private Boolean denoise;
        
        @Schema(description = "是否校正倾斜")
        private Boolean deskew;
    }
    
    // ==================== OCR引擎常量 ====================
    
    public static final String ENGINE_PADDLEOCR = "paddleocr";
    public static final String ENGINE_TESSERACT = "tesseract";
}
