voa_config/file/technology/
settings.rs1use garde::Validate;
4use serde::{Deserialize, Serialize};
5
6use crate::{ConfigOrigin, file::ConfigOpenpgpSettings};
7
8#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, Validate)]
17#[serde(rename_all = "lowercase")]
18pub struct ConfigTechnologySettings {
19 #[serde(skip)]
20 #[garde(skip)]
21 pub(crate) origins: Vec<ConfigOrigin>,
22
23 #[garde(dive)]
24 openpgp: Option<ConfigOpenpgpSettings>,
25}
26
27impl ConfigTechnologySettings {
28 #[allow(dead_code)]
31 pub(crate) fn new(origins: Vec<ConfigOrigin>, openpgp: Option<ConfigOpenpgpSettings>) -> Self {
32 Self { origins, openpgp }
33 }
34
35 pub(crate) fn config_openpgp_settings(&self) -> Option<&ConfigOpenpgpSettings> {
37 self.openpgp.as_ref()
38 }
39
40 pub fn origins(&self) -> &[ConfigOrigin] {
42 &self.origins
43 }
44}
45
46impl Default for ConfigTechnologySettings {
47 fn default() -> Self {
48 Self {
49 origins: vec![ConfigOrigin::Default],
50 openpgp: Some(ConfigOpenpgpSettings::default()),
51 }
52 }
53}