use std::path::PathBuf;
use super::PathRule;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FederationSource {
pub target: FederationSourceTarget,
pub config_path: PathBuf,
pub plugin: String,
pub key: &'static str,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FederationSourceTarget {
Exposed(PathRule),
Remote(String),
}
impl FederationSource {
#[must_use]
pub(super) fn prefixed(&self, ws_prefix: &str) -> Self {
let target = match &self.target {
FederationSourceTarget::Exposed(rule) => {
FederationSourceTarget::Exposed(rule.prefixed(ws_prefix))
}
FederationSourceTarget::Remote(alias) => FederationSourceTarget::Remote(alias.clone()),
};
Self {
target,
config_path: self.config_path.clone(),
plugin: self.plugin.clone(),
key: self.key,
}
}
}