use crate::types::*;
use anyhow::Result;
use std::path::Path;
pub trait Preprocessor: Send + Sync {
fn parse_pdf_to_markup_language(&self, pdf_bytes: &[u8]) -> Result<String>;
fn parse_markup_to_preprocessor_output(&self, markup: &str) -> Result<PreprocessorOutput>;
fn process(&self, document_bytes: &[u8]) -> Result<PreprocessorOutput> {
let markup = self.parse_pdf_to_markup_language(document_bytes)?;
self.parse_markup_to_preprocessor_output(&markup)
}
fn process_file(&self, input: &Path) -> Result<PreprocessorOutput> {
let bytes = std::fs::read(input)?;
self.process(&bytes)
}
fn name(&self) -> &str;
fn supports_file_type(&self, path: &Path) -> bool;
}