/*
 * 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 Actor {
    /// The unique identifier of the actor.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Time (in UTC) the actor was created.
    #[serde(rename = "create_time", skip_serializing_if = "Option::is_none")]
    pub create_time: Option<String>,
    /// The Docker image associated with the actor.
    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
    pub image: Option<String>,
    /// The default environment variables and values for the actor.
    #[serde(
        rename = "default_environment",
        skip_serializing_if = "Option::is_none"
    )]
    pub default_environment: Option<serde_json::Value>,
    /// User provided description of the actor.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Time (in UTC) the actor was last updated.
    #[serde(rename = "last_update_time", skip_serializing_if = "Option::is_none")]
    pub last_update_time: Option<String>,
    /// Actor identifier of actor to link this actor's events too. May be an actor id or an alias. Cycles not permitted.
    #[serde(rename = "link", skip_serializing_if = "Option::is_none")]
    pub link: Option<String>,
    #[serde(rename = "mounts", skip_serializing_if = "Option::is_none")]
    pub mounts: Option<Vec<models::ActorMount>>,
    /// The user who created this actor.
    #[serde(rename = "owner", skip_serializing_if = "Option::is_none")]
    pub owner: Option<String>,
    /// Whether the actor runs in privileged mode.
    #[serde(rename = "privileged", skip_serializing_if = "Option::is_none")]
    pub privileged: Option<bool>,
    /// The command channel that this actor uses.
    #[serde(rename = "queue", skip_serializing_if = "Option::is_none")]
    pub queue: Option<String>,
    /// Current state for the actor.
    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
    pub state: Option<serde_json::Value>,
    /// Whether the actor stores private state between executions.
    #[serde(rename = "stateless", skip_serializing_if = "Option::is_none")]
    pub stateless: Option<bool>,
    /// Whether this actor requires an OAuth token.
    #[serde(rename = "token", skip_serializing_if = "Option::is_none")]
    pub token: Option<bool>,
    /// Current status of the actor.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// Explanation of status.
    #[serde(rename = "status_message", skip_serializing_if = "Option::is_none")]
    pub status_message: Option<String>,
    /// String of 'yyyy-mm-dd hh + <number> <unit of time>' format. Turns on cron feature for actor so that at the specified times the actor with execute with a generic static message.
    #[serde(rename = "cron_schedule", skip_serializing_if = "Option::is_none")]
    pub cron_schedule: Option<String>,
    /// Variable to turn on or off the cron schedule feature for the actor.
    #[serde(rename = "cron_on", skip_serializing_if = "Option::is_none")]
    pub cron_on: Option<bool>,
    /// Next cron execution time for the actor. Only used when `cronOn` is set to True.
    #[serde(rename = "cron_next_ex", skip_serializing_if = "Option::is_none")]
    pub cron_next_ex: Option<String>,
    /// Return type (none, bin, json) for this actor. Default is none.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
}

impl Actor {
    pub fn new() -> Actor {
        Actor {
            id: None,
            create_time: None,
            image: None,
            default_environment: None,
            description: None,
            last_update_time: None,
            link: None,
            mounts: None,
            owner: None,
            privileged: None,
            queue: None,
            state: None,
            stateless: None,
            token: None,
            status: None,
            status_message: None,
            cron_schedule: None,
            cron_on: None,
            cron_next_ex: None,
            r#type: None,
        }
    }
}
/// Return type (none, bin, json) for this actor. Default is none.
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum Type {
    #[serde(rename = "none")]
    #[default]
    None,
    #[serde(rename = "bin")]
    Bin,
    #[serde(rename = "json")]
    Json,
}
