// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// An extraction's output annotated with the source that backs each value.
/// Returned when fetching the sources for an extraction. Carries the source
/// `file` and its detected `document_type`, the original `extraction` output,
/// and a parallel `sources` tree where each leaf is a `{value, source}` object
/// locating the value in the document (a page region for PDFs, a cell for
/// spreadsheets, a text span for plain text, and so on).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SourcesResponse {
    /// Defaults to `extraction.sources`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
    /// ID of the extraction
    pub extraction_id: String,
    /// Detected document type of the source file
    pub document_type: SourcesResponseDocumentType,
    /// File metadata (id, filename, mime_type)
    pub file: FileRef,
    /// Original extraction output
    pub extraction: std::collections::HashMap<String, serde_json::Value>,
    /// Same shape as extraction but leaves are {value, source} objects
    pub sources: std::collections::HashMap<String, serde_json::Value>,
}
impl SourcesResponse {
    /// Construct a new `SourcesResponse` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        extraction_id: impl Into<String>,
        document_type: SourcesResponseDocumentType,
        file: FileRef,
        extraction: std::collections::HashMap<String, serde_json::Value>,
        sources: std::collections::HashMap<String, serde_json::Value>,
    ) -> Self {
        Self {
            object: Default::default(),
            extraction_id: extraction_id.into(),
            document_type,
            file,
            extraction,
            sources,
        }
    }
}
