#[allow(unused)]
use super::super::session::config::SessionConfig;
#[allow(unused)]
use super::super::ExecuteQueryBuilder;
#[allow(unused)]
use super::DriverConfig;
#[allow(unused)]
use crate::Neo4jError;
#[derive(Debug, Clone, Eq, PartialEq, Default)]
pub struct NotificationFilter {
pub(crate) minimum_severity: Option<MinimumSeverity>,
pub(crate) disabled_classifications: Option<Vec<DisabledClassification>>,
}
impl NotificationFilter {
pub fn new() -> Self {
Self::default()
}
pub fn new_disable_all() -> Self {
Self {
minimum_severity: Some(MinimumSeverity::Disabled),
disabled_classifications: None,
}
}
#[inline]
pub fn with_minimum_severity(mut self, minimum_severity: MinimumSeverity) -> Self {
self.minimum_severity = Some(minimum_severity);
self
}
#[inline]
pub fn with_default_minimum_severity(mut self) -> Self {
self.minimum_severity = None;
self
}
#[inline]
pub fn with_disabled_classifications(
mut self,
disabled_classifications: Vec<DisabledClassification>,
) -> Self {
self.disabled_classifications = Some(disabled_classifications);
self
}
#[inline]
pub fn with_disabled_categories(self, disabled_categories: Vec<DisabledCategory>) -> Self {
self.with_disabled_classifications(disabled_categories)
}
#[inline]
pub fn with_default_disabled_classifications(mut self) -> Self {
self.disabled_classifications = None;
self
}
#[inline]
pub fn with_default_disabled_categories(self) -> Self {
self.with_default_disabled_classifications()
}
pub(crate) fn is_default(&self) -> bool {
self.minimum_severity.is_none() && self.disabled_classifications.is_none()
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum MinimumSeverity {
Disabled,
Warning,
Information,
}
impl MinimumSeverity {
pub(crate) fn as_protocol_str(&self) -> &'static str {
match self {
Self::Disabled => "OFF",
Self::Warning => "WARNING",
Self::Information => "INFORMATION",
}
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum DisabledCategory {
Hint,
Unrecognized,
Unsupported,
Performance,
Deprecation,
Generic,
Security,
Topology,
Schema,
}
pub type DisabledClassification = DisabledCategory;
impl DisabledCategory {
pub(crate) fn as_protocol_str(&self) -> &'static str {
match self {
Self::Hint => "HINT",
Self::Unrecognized => "UNRECOGNIZED",
Self::Unsupported => "UNSUPPORTED",
Self::Performance => "PERFORMANCE",
Self::Deprecation => "DEPRECATION",
Self::Generic => "GENERIC",
Self::Security => "SECURITY",
Self::Topology => "TOPOLOGY",
Self::Schema => "SCHEMA",
}
}
}