/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.2
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AppWithLastVersionWDraft {
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "workspace_id")]
    pub workspace_id: String,
    #[serde(rename = "path")]
    pub path: String,
    #[serde(rename = "summary")]
    pub summary: String,
    #[serde(rename = "versions")]
    pub versions: Vec<i32>,
    #[serde(rename = "created_by")]
    pub created_by: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "value", deserialize_with = "Option::deserialize")]
    pub value: Option<serde_json::Value>,
    #[serde(rename = "policy")]
    pub policy: Box<models::Policy>,
    #[serde(rename = "execution_mode")]
    pub execution_mode: ExecutionMode,
    #[serde(rename = "extra_perms")]
    pub extra_perms: std::collections::HashMap<String, bool>,
    #[serde(rename = "custom_path", skip_serializing_if = "Option::is_none")]
    pub custom_path: Option<String>,
    #[serde(rename = "raw_app")]
    pub raw_app: bool,
    #[serde(rename = "bundle_secret", skip_serializing_if = "Option::is_none")]
    pub bundle_secret: Option<String>,
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
    pub draft_only: Option<bool>,
    #[serde(rename = "draft", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub draft: Option<Option<serde_json::Value>>,
}

impl AppWithLastVersionWDraft {
    pub fn new(id: i32, workspace_id: String, path: String, summary: String, versions: Vec<i32>, created_by: String, created_at: String, value: Option<serde_json::Value>, policy: models::Policy, execution_mode: ExecutionMode, extra_perms: std::collections::HashMap<String, bool>, raw_app: bool) -> AppWithLastVersionWDraft {
        AppWithLastVersionWDraft {
            id,
            workspace_id,
            path,
            summary,
            versions,
            created_by,
            created_at,
            value,
            policy: Box::new(policy),
            execution_mode,
            extra_perms,
            custom_path: None,
            raw_app,
            bundle_secret: None,
            labels: None,
            draft_only: None,
            draft: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ExecutionMode {
    #[serde(rename = "viewer")]
    Viewer,
    #[serde(rename = "publisher")]
    Publisher,
    #[serde(rename = "anonymous")]
    Anonymous,
}

impl Default for ExecutionMode {
    fn default() -> ExecutionMode {
        Self::Viewer
    }
}

