use nonempty_collections::NEVec;
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use zenoh_core::polyfill::*;
use zenoh_protocol::core::{RegionName, WhatAmIMatcher};
use crate::{Interface, ZenohId};
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GatewayConf {
pub south: Option<GatewaySouthConf>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GatewaySouthConf {
Preset(GatewayPresetConf),
Custom(Vec<GatewayExplicitSouthConf>),
}
impl Default for GatewaySouthConf {
fn default() -> Self {
GatewaySouthConf::Preset(GatewayPresetConf::default())
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum GatewayPresetConf {
#[default]
Auto,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GatewayExplicitSouthConf {
pub filters: Option<Vec<GatewayFiltersConf>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GatewayFiltersConf {
pub modes: Option<WhatAmIMatcher>,
pub interfaces: Option<NEVec<Interface>>,
pub zids: Option<NEVec<ZenohId>>,
pub region_names: Option<NEVec<RegionName>>,
#[serde(default)]
pub negated: bool,
}