/*
 * 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 NewActor {
    /// The Docker image associated with the actor.
    #[serde(rename = "image")]
    pub image: String,
    /// Whether this actor requires an OAuth token.
    #[serde(rename = "token", skip_serializing_if = "Option::is_none")]
    pub token: Option<bool>,
    /// 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>,
    /// Whether the actor runs in privileged mode (requires admin role).
    #[serde(rename = "privileged", skip_serializing_if = "Option::is_none")]
    pub privileged: Option<bool>,
    /// The command channel that this actor uses.
    #[serde(
        rename = "queue",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub queue: Option<Option<String>>,
    /// Whether the actor stores private state between executions.
    #[serde(rename = "stateless", skip_serializing_if = "Option::is_none")]
    pub stateless: Option<bool>,
    /// 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",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub link: Option<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>,
}

impl NewActor {
    pub fn new(image: String) -> NewActor {
        NewActor {
            image,
            token: None,
            default_environment: None,
            description: None,
            privileged: None,
            queue: None,
            stateless: None,
            link: None,
            cron_schedule: None,
            cron_on: None,
        }
    }
}
