/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 4b3f595
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// SnapshotPlan : Details of the active snapshot plan.  Not available if the `status` is `initializing`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SnapshotPlan {
    /// Day of the month when the Snapshot Plan is executed.  Null means every day.
    #[serde(rename = "day_of_month", deserialize_with = "Option::deserialize")]
    pub day_of_month: Option<i32>,
    /// Day of the week when the Snapshot Plan is executed.  Starts at 1 for Monday til 7 for Sunday. Null means every day.
    #[serde(rename = "day_of_week", deserialize_with = "Option::deserialize")]
    pub day_of_week: Option<i32>,
    /// Hour when the Snapshot Plan is executed (UTC).
    #[serde(rename = "hour")]
    pub hour: i32,
    /// Maximum amount of Snapshots that will be created by this Snapshot Plan.  Older Snapshots will be deleted.
    #[serde(rename = "max_snapshots")]
    pub max_snapshots: i32,
    /// Minute when the Snapshot Plan is executed (UTC).
    #[serde(rename = "minute")]
    pub minute: i32,
}

impl SnapshotPlan {
    /// Details of the active snapshot plan.  Not available if the `status` is `initializing`.
    pub fn new(
        day_of_month: Option<i32>,
        day_of_week: Option<i32>,
        hour: i32,
        max_snapshots: i32,
        minute: i32,
    ) -> SnapshotPlan {
        SnapshotPlan {
            day_of_month,
            day_of_week,
            hour,
            max_snapshots,
            minute,
        }
    }
}
