// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// A classification result: the categories a document was scored against and the chosen `output` decision.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Classification {
    /// Unique identifier of the classification
    pub id: String,
    /// Information about the classified file
    pub file: FileRef,
    /// Model used for classification
    pub model: String,
    /// Categories the document was classified against
    pub categories: Vec<Category>,
    /// 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 classification request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// The classification result with reasoning. A degenerate empty decision until status == 'completed'; gate reads on status.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output: Option<ClassificationDecision>,
    /// 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<ClassificationStatus>,
    /// 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 classification runs
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub consensus: Option<ClassificationConsensus>,
    /// Usage information for the classification
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub usage: Option<RetabUsage>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_at: Option<String>,
}
impl Classification {
    /// Construct a new `Classification` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        file: FileRef,
        model: impl Into<String>,
        categories: Vec<Category>,
    ) -> Self {
        Self {
            id: id.into(),
            file,
            model: model.into(),
            categories,
            n_consensus: Default::default(),
            instructions: Default::default(),
            output: Default::default(),
            status: Default::default(),
            error: Default::default(),
            consensus: Default::default(),
            usage: Default::default(),
            created_at: Default::default(),
        }
    }
}
