/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.6
 * 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 CreateAppRequest {
    #[serde(rename = "path")]
    pub path: String,
    #[serde(rename = "value", deserialize_with = "Option::deserialize")]
    pub value: Option<serde_json::Value>,
    #[serde(rename = "summary")]
    pub summary: String,
    #[serde(rename = "policy")]
    pub policy: Box<models::Policy>,
    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
    pub draft_only: Option<bool>,
    #[serde(rename = "deployment_message", skip_serializing_if = "Option::is_none")]
    pub deployment_message: Option<String>,
    #[serde(rename = "custom_path", skip_serializing_if = "Option::is_none")]
    pub custom_path: Option<String>,
    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original on_behalf_of value in the policy instead of overwriting it.
    #[serde(rename = "preserve_on_behalf_of", skip_serializing_if = "Option::is_none")]
    pub preserve_on_behalf_of: Option<bool>,
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
}

impl CreateAppRequest {
    pub fn new(path: String, value: Option<serde_json::Value>, summary: String, policy: models::Policy) -> CreateAppRequest {
        CreateAppRequest {
            path,
            value,
            summary,
            policy: Box::new(policy),
            draft_only: None,
            deployment_message: None,
            custom_path: None,
            preserve_on_behalf_of: None,
            labels: None,
        }
    }
}

