/*
 * 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};

/// AddRecordsToRrsetRequest : Request for POST https://api.hetzner.cloud/v1/zones/{id_or_name}/rrsets/{rr_name}/{rr_type}/actions/add_records
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AddRecordsToRrsetRequest {
    /// Records to add to the RRSet.  Must not be empty and must only contain distinct record values.
    #[serde(rename = "records")]
    pub records: Vec<models::ResourceRecord>,
    /// Time To Live (TTL) of the RRSet.  If not set, the Zone's Default TTL is used. If set, and the RRSet being updated already has a TTL, the values must be the same.
    #[serde(
        rename = "ttl",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub ttl: Option<Option<i32>>,
}

impl AddRecordsToRrsetRequest {
    /// Request for POST https://api.hetzner.cloud/v1/zones/{id_or_name}/rrsets/{rr_name}/{rr_type}/actions/add_records
    pub fn new(records: Vec<models::ResourceRecord>) -> AddRecordsToRrsetRequest {
        AddRecordsToRrsetRequest { records, ttl: None }
    }
}
