use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct Instance {
    #[serde(rename = "network-config")]
    pub network_config: InstanceNetworkConfig,
}

#[derive(Debug, Deserialize)]
pub struct InstanceNetworkConfig {
    pub config: Vec<InstanceNetworkConfigConfig>,
}

#[derive(Debug, Deserialize)]
pub struct InstanceNetworkConfigConfig {
    pub name: String,
    pub subnets: Vec<InstanceNetworkConfigConfigSubnet>,
}

#[derive(Debug, Deserialize)]
#[serde(tag = "type")]
pub enum InstanceNetworkConfigConfigSubnet {
    #[serde(rename = "static")]
    Static {
        ipv6: Option<bool>,
        ipv4: Option<bool>,
        address: String,
        gateway: String,
    },
    #[serde(rename = "dhcp")]
    Dhcp {},
}
