use crate::Rect;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Diagnostic {
pub code: String,
pub page_index: usize,
pub message: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Character {
pub index: usize,
pub unicode: u32,
pub is_generated: bool,
pub text: Option<String>,
pub font_name: String,
pub font_size_pt: f64,
pub angle_degrees: f64,
pub origin: [f64; 2],
pub tight_bounds: Rect,
pub loose_bounds: Rect,
pub visual_tight_bounds: Rect,
pub visual_loose_bounds: Rect,
pub visual_origin: [f64; 2],
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Page {
pub page_index: usize,
pub width_pt: f64,
pub height_pt: f64,
pub text: String,
pub object_count: usize,
pub characters: Vec<Character>,
pub page_bounds: Rect,
pub rotation: u16,
pub visual_width_pt: f64,
pub visual_height_pt: f64,
pub paths: Vec<VectorPath>,
pub images: Vec<ImageFact>,
pub links: Vec<LinkFact>,
pub form_count: usize,
pub drawing_lines: Vec<DrawingLine>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DrawingLine {
pub start: [f64; 2],
pub end: [f64; 2],
pub bounds: Rect,
pub width: f64,
pub orientation: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PathSegment {
pub kind: String,
pub point: [f64; 2],
pub local_point: [f64; 2],
pub close: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VectorPath {
pub object_path: Vec<usize>,
pub bounds: Rect,
pub visual_bounds: Rect,
pub evidence_bounds: Option<Rect>,
pub clip_bounds: Option<Rect>,
pub matrix: [f64; 6],
pub segments: Vec<PathSegment>,
pub fill_rule: String,
pub fill_rgba: [u8; 4],
pub stroke: bool,
pub stroke_rgba: [u8; 4],
pub stroke_width_local: f64,
pub fill_visible: bool,
pub stroke_visible: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImageFact {
pub object_path: Vec<usize>,
pub bounds: Rect,
pub visual_bounds: Rect,
pub clip_bounds: Option<Rect>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LinkFact {
pub index: usize,
pub bounds: Rect,
pub visual_bounds: Rect,
pub uri: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Document {
pub schema_version: u32,
pub coordinate_system: String,
pub source_page_count: usize,
pub pages: Vec<Page>,
pub diagnostics: Vec<Diagnostic>,
}