/*
 * 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 ActorWorker {
    /// Identifier for the worker channel; used to send management commands to the worker.
    #[serde(rename = "ch_name", skip_serializing_if = "Option::is_none")]
    pub ch_name: Option<String>,
    /// The container id for the worker.
    #[serde(rename = "cid", skip_serializing_if = "Option::is_none")]
    pub cid: Option<String>,
    /// The time (UTC) the worker was created.
    #[serde(rename = "create_time", skip_serializing_if = "Option::is_none")]
    pub create_time: Option<String>,
    /// unique id for the worker.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The docker image for the actor assigned to the worker.
    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
    pub image: Option<String>,
    /// The last ime (UTC) the worker started an execution.
    #[serde(
        rename = "last_execution_time",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_execution_time: Option<String>,
    /// The last ime (UTC) the worker responded to a health check.
    #[serde(
        rename = "last_health_check_time",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_health_check_time: Option<String>,
    /// The location of the docker daemon used by this worker.
    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
    pub location: Option<String>,
    /// Status of the worker.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// tenant assoicated with the worker.
    #[serde(rename = "tenant", skip_serializing_if = "Option::is_none")]
    pub tenant: Option<String>,
}

impl ActorWorker {
    pub fn new() -> ActorWorker {
        ActorWorker {
            ch_name: None,
            cid: None,
            create_time: None,
            id: None,
            image: None,
            last_execution_time: None,
            last_health_check_time: None,
            location: None,
            status: None,
            tenant: None,
        }
    }
}
/// Status of the worker.
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum Status {
    #[serde(rename = "REQUESTED")]
    #[default]
    Requested,
    #[serde(rename = "SPAWNER SETUP")]
    SpawnerSetup,
    #[serde(rename = "PULLING IMAGE")]
    PullingImage,
    #[serde(rename = "CREATING CONTAINER")]
    CreatingContainer,
    #[serde(rename = "UPDATING STORE")]
    UpdatingStore,
    #[serde(rename = "READY")]
    Ready,
    #[serde(rename = "BUSY")]
    Busy,
    #[serde(rename = "ERROR")]
    Error,
}
