/*
 * Abaco API
 *
 * Abaco (Actor Based Containers) is an API and distributed computing platform funded by the National Science Foundation to provide Functions-as-a-service to the research computing community. Abaco leverages Docker containers and the Actor Model of Concurrent Computation to provide generic function primitives that are portable, composable and scalable.
 *
 * The version of the OpenAPI document: 1
 * Contact: cicsupport@tacc.utexas.edu
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActorExecution {
    /// the id of the actor
    #[serde(rename = "actor_id", skip_serializing_if = "Option::is_none")]
    pub actor_id: Option<String>,
    /// the base URL for this Abaco instance.
    #[serde(rename = "api_server", skip_serializing_if = "Option::is_none")]
    pub api_server: Option<String>,
    /// The user who owns the associated actor.
    #[serde(rename = "owner", skip_serializing_if = "Option::is_none")]
    pub owner: Option<String>,
    #[serde(rename = "cpu", skip_serializing_if = "Option::is_none")]
    pub cpu: Option<i32>,
    /// the id of the executions
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// the time the execution started.
    #[serde(rename = "start_time", skip_serializing_if = "Option::is_none")]
    pub start_time: Option<String>,
    /// the status of the execution.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// the time the message was originally received by Abaco.
    #[serde(
        rename = "message_received_time",
        skip_serializing_if = "Option::is_none"
    )]
    pub message_received_time: Option<String>,
    #[serde(rename = "io", skip_serializing_if = "Option::is_none")]
    pub io: Option<i32>,
    #[serde(rename = "runtime", skip_serializing_if = "Option::is_none")]
    pub runtime: Option<i32>,
    /// the id of the Abaco worker that supervised the execution.
    #[serde(rename = "worker_id", skip_serializing_if = "Option::is_none")]
    pub worker_id: Option<String>,
}

impl ActorExecution {
    pub fn new() -> ActorExecution {
        ActorExecution {
            actor_id: None,
            api_server: None,
            owner: None,
            cpu: None,
            id: None,
            start_time: None,
            status: None,
            message_received_time: None,
            io: None,
            runtime: None,
            worker_id: None,
        }
    }
}
/// the status of the execution.
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum Status {
    #[serde(rename = "SUBMITTED")]
    #[default]
    Submitted,
    #[serde(rename = "RUNNING")]
    Running,
    #[serde(rename = "COMPLETE")]
    Complete,
}
