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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ZoneAuthoritativeNameservers {
    /// Authoritative Hetzner nameservers assigned to this Zone.
    #[serde(rename = "assigned")]
    pub assigned: Vec<String>,
    /// Authoritative nameservers currently delegated to by the parent DNS zone.  If these don't match the assigned authoritative nameservers, the DNS zone is currently not being served by Hetzner.
    #[serde(rename = "delegated")]
    pub delegated: Vec<String>,
    /// Point in time (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format) when the DNS zone delegation was last checked.
    #[serde(
        rename = "delegation_last_check",
        deserialize_with = "Option::deserialize"
    )]
    pub delegation_last_check: Option<String>,
    /// Status of the delegation.  - `valid` - Parent zone correctly delegates to assigned nameservers. - `partially-valid` - Parent zone delegates to additional Hetzner nameservers not assigned to this zone. - `invalid` - Parent zone does not delegate to the assigned nameservers. - `lame` - Parent zone delegates to nameservers that don't know the zone. - `unregistered` - Domain is not registered. - `unknown` - Not yet known.
    #[serde(rename = "delegation_status", skip_serializing_if = "Option::is_none")]
    pub delegation_status: Option<DelegationStatus>,
}

impl ZoneAuthoritativeNameservers {
    pub fn new(
        assigned: Vec<String>,
        delegated: Vec<String>,
        delegation_last_check: Option<String>,
    ) -> ZoneAuthoritativeNameservers {
        ZoneAuthoritativeNameservers {
            assigned,
            delegated,
            delegation_last_check,
            delegation_status: None,
        }
    }
}
/// Status of the delegation.  - `valid` - Parent zone correctly delegates to assigned nameservers. - `partially-valid` - Parent zone delegates to additional Hetzner nameservers not assigned to this zone. - `invalid` - Parent zone does not delegate to the assigned nameservers. - `lame` - Parent zone delegates to nameservers that don't know the zone. - `unregistered` - Domain is not registered. - `unknown` - Not yet known.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DelegationStatus {
    #[serde(rename = "invalid")]
    Invalid,
    #[serde(rename = "lame")]
    Lame,
    #[serde(rename = "partially-valid")]
    PartiallyValid,
    #[serde(rename = "unknown")]
    Unknown,
    #[serde(rename = "unregistered")]
    Unregistered,
    #[serde(rename = "valid")]
    Valid,
}

impl Default for DelegationStatus {
    fn default() -> DelegationStatus {
        Self::Invalid
    }
}
