late 0.0.1151

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.244.2
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SupportRun {
    /// Run id, a 24-character hex string.
    #[serde(rename = "runId")]
    pub run_id: String,
    /// Conversation thread id. Send it back as `threadId` to ask a follow-up in the same thread.
    #[serde(rename = "threadId")]
    pub thread_id: String,
    /// queued and running are in progress. needs_human means Ana handed the question to a person instead of answering.
    #[serde(rename = "status")]
    pub status: Status,
    /// Why the run stopped. Null while it is in progress.
    #[serde(rename = "stopReason", deserialize_with = "Option::deserialize")]
    pub stop_reason: Option<StopReason>,
    /// Ana's answer. Null while the run is in progress or when it failed.
    #[serde(rename = "answer", deserialize_with = "Option::deserialize")]
    pub answer: Option<String>,
    #[serde(rename = "usage")]
    pub usage: Box<models::SupportRunUsage>,
    /// The amount billed for the run, in USD: the model cost plus 20%, never above `maxCostUsd`. 0 for a failed run.
    #[serde(rename = "costUsd")]
    pub cost_usd: f64,
    /// The cost cap this run was started with, in USD.
    #[serde(rename = "maxCostUsd")]
    pub max_cost_usd: f64,
    #[serde(rename = "createdAt")]
    pub created_at: String,
    #[serde(rename = "startedAt", deserialize_with = "Option::deserialize")]
    pub started_at: Option<String>,
    #[serde(rename = "finishedAt", deserialize_with = "Option::deserialize")]
    pub finished_at: Option<String>,
    /// Seconds to wait before polling again. Present only while the run is queued or running.
    #[serde(rename = "pollAfterSeconds", skip_serializing_if = "Option::is_none")]
    pub poll_after_seconds: Option<i32>,
}

impl SupportRun {
    pub fn new(
        run_id: String,
        thread_id: String,
        status: Status,
        stop_reason: Option<StopReason>,
        answer: Option<String>,
        usage: models::SupportRunUsage,
        cost_usd: f64,
        max_cost_usd: f64,
        created_at: String,
        started_at: Option<String>,
        finished_at: Option<String>,
    ) -> SupportRun {
        SupportRun {
            run_id,
            thread_id,
            status,
            stop_reason,
            answer,
            usage: Box::new(usage),
            cost_usd,
            max_cost_usd,
            created_at,
            started_at,
            finished_at,
            poll_after_seconds: None,
        }
    }
}
/// queued and running are in progress. needs_human means Ana handed the question to a person instead of answering.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "queued")]
    Queued,
    #[serde(rename = "running")]
    Running,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "needs_human")]
    NeedsHuman,
    #[serde(rename = "failed")]
    Failed,
}

impl Default for Status {
    fn default() -> Status {
        Self::Queued
    }
}
/// Why the run stopped. Null while it is in progress.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StopReason {
    #[serde(rename = "answered")]
    Answered,
    #[serde(rename = "human_review")]
    HumanReview,
    #[serde(rename = "cost_cap")]
    CostCap,
    #[serde(rename = "deadline")]
    Deadline,
    #[serde(rename = "max_iterations")]
    MaxIterations,
    #[serde(rename = "error")]
    Error,
    #[serde(rename = "expired")]
    Expired,
}

impl Default for StopReason {
    fn default() -> StopReason {
        Self::Answered
    }
}