// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// A document split produced by a workflow run, tagged with its artifact `operation` and creation time.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SplitWorkflowArtifact {
    /// Unique identifier of the split result
    pub id: String,
    /// Information about the split file
    pub file: FileRef,
    /// Model used for the split operation
    pub model: String,
    /// Subdocuments used for the split operation
    pub subdocuments: Vec<Subdocument>,
    /// Number of consensus votes used
    ///
    /// Defaults to `1`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub n_consensus: Option<i64>,
    /// Free-form instructions supplied with the split request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// The list of document splits with their assigned pages. Empty [] until status == 'completed'.
    ///
    /// Defaults to `[]`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output: Option<Vec<SplitResult>>,
    /// 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<SplitWorkflowArtifactStatus>,
    /// 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>,
    /// Consensus metadata for multi-vote split runs
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub consensus: Option<SplitConsensus>,
    /// Usage information for the split 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 `split`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub operation: Option<String>,
}
impl SplitWorkflowArtifact {
    /// Construct a new `SplitWorkflowArtifact` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        file: FileRef,
        model: impl Into<String>,
        subdocuments: Vec<Subdocument>,
        created_at: impl Into<String>,
    ) -> Self {
        Self {
            id: id.into(),
            file,
            model: model.into(),
            subdocuments,
            n_consensus: Default::default(),
            instructions: Default::default(),
            output: Default::default(),
            status: Default::default(),
            error: Default::default(),
            consensus: Default::default(),
            usage: Default::default(),
            created_at: created_at.into(),
            operation: Default::default(),
        }
    }
}
