/*
 * Tapis Pods Service
 *
 *  The Pods Service is a web service and distributed computing platform providing pods-as-a-service (PaaS). The service  implements a message broker and processor model that requests pods, alongside a health module to poll for pod data, including logs, status, and health. The primary use of this service is to have quick to deploy long-lived services based on Docker images that are exposed via HTTP or TCP endpoints listed by the API.  **The Pods service provides functionality for two types of pod solutions:**  * **Templated Pods** for run-as-is popular images. Neo4J is one example, the template manages TCP ports, user creation, and permissions.  * **Custom Pods** for arbitrary docker images with less functionality. In this case we will expose port 5000 and do nothing else.   The live-docs act as the most up-to-date API reference. Visit the [documentation for more information](https://tapis.readthedocs.io/en/latest/technical/pods.html).
 *
 * The version of the OpenAPI document: 26Q1.1
 * Contact: cicsupport@tacc.utexas.edu
 * Generated by: https://openapi-generator.tech
 */

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

/// SnapshotResponseModel : Response object for Snapshot class.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SnapshotResponseModel {
    /// Name of this snapshot.
    #[serde(rename = "snapshot_id")]
    pub snapshot_id: String,
    /// The volume_id to use as source of snapshot.
    #[serde(rename = "source_volume_id")]
    pub source_volume_id: String,
    /// Path in source volume_id to make snapshot of
    #[serde(rename = "source_volume_path")]
    pub source_volume_path: String,
    /// Path to copy to. Snapshots of singular files require destination_path.
    #[serde(rename = "destination_path", skip_serializing_if = "Option::is_none")]
    pub destination_path: Option<String>,
    /// Description of this snapshot.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Size in MB to limit snapshot to. We'll start warning if you've gone past the limit.
    #[serde(rename = "size_limit", skip_serializing_if = "Option::is_none")]
    pub size_limit: Option<i32>,
    /// cron bits
    #[serde(rename = "cron", skip_serializing_if = "Option::is_none")]
    pub cron: Option<String>,
    /// retention_policy bits
    #[serde(rename = "retention_policy", skip_serializing_if = "Option::is_none")]
    pub retention_policy: Option<String>,
    /// Size of snapshot currently in MB
    #[serde(rename = "size", skip_serializing_if = "Option::is_none")]
    pub size: Option<i32>,
    /// Current status of snapshot.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    #[serde(
        rename = "creation_ts",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub creation_ts: Option<Option<String>>,
    #[serde(
        rename = "update_ts",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub update_ts: Option<Option<String>>,
}

impl SnapshotResponseModel {
    /// Response object for Snapshot class.
    pub fn new(
        snapshot_id: String,
        source_volume_id: String,
        source_volume_path: String,
    ) -> SnapshotResponseModel {
        SnapshotResponseModel {
            snapshot_id,
            source_volume_id,
            source_volume_path,
            destination_path: None,
            description: None,
            size_limit: None,
            cron: None,
            retention_policy: None,
            size: None,
            status: None,
            creation_ts: None,
            update_ts: None,
        }
    }
}
