// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// A parse produced by a workflow run, tagged with its artifact `operation` and creation time.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ParseWorkflowArtifact {
    /// Unique identifier of the parse
    pub id: String,
    /// Information about the parsed file
    pub file: FileRef,
    /// Model used for parsing
    pub model: String,
    /// Format used to render tables extracted from the document
    pub table_parsing_format: ParseWorkflowArtifactTableParsingFormat,
    /// DPI used when rasterizing pages for the parser
    pub image_resolution_dpi: i64,
    /// Free-form instructions supplied with the parse request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// The parsed document content
    pub output: ParseOutput,
    /// Lifecycle status. The synchronous path returns 'completed'. Background runs progress pending -> queued -> in_progress -> completed | failed | cancelled.
    ///
    /// Defaults to `pending`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ParseWorkflowArtifactStatus>,
    /// Error details when a background run fails; null otherwise. Always present so consumers can read it without an existence check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<PrimitiveError>,
    /// Usage information for the parse operation
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub usage: Option<RetabUsage>,
    /// Timestamp when this artifact was created.
    pub created_at: String,
    /// The operation that produced this artifact
    ///
    /// Defaults to `parse`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub operation: Option<String>,
}
impl ParseWorkflowArtifact {
    /// Construct a new `ParseWorkflowArtifact` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        file: FileRef,
        model: impl Into<String>,
        table_parsing_format: ParseWorkflowArtifactTableParsingFormat,
        image_resolution_dpi: i64,
        output: ParseOutput,
        created_at: impl Into<String>,
    ) -> Self {
        Self {
            id: id.into(),
            file,
            model: model.into(),
            table_parsing_format,
            image_resolution_dpi,
            instructions: Default::default(),
            output,
            status: Default::default(),
            error: Default::default(),
            usage: Default::default(),
            created_at: created_at.into(),
            operation: Default::default(),
        }
    }
}
