Skip to main content

brooks_lib/cdni/mel/
spec.rs

1// brooks, Copyright 2026, Will Hawkins
2//
3// This file is part of brooks.
4
5// This file is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18//! MEL metadata definitions
19
20use crate::macros::IntoCdniMetadata;
21use brooks_macros::CdniMetadata;
22
23use serde::{Deserialize, Serialize};
24use serde_json::Value;
25
26use std::fmt::Debug;
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct SetVariable<A: Debug + Clone + Default> {
30    #[serde(rename = "variable-name")]
31    pub variable_name: String,
32    #[serde(rename = "variable-value")]
33    pub variable_value: String,
34    #[serde(rename = "value-is-expression")]
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub value_is_expression: Option<bool>,
37
38    #[serde(skip)]
39    pub aug: A,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize, CdniMetadata)]
43pub struct TypedSetVariable<A: Debug + Clone + Default> {
44    #[serde(rename = "generic-metadata-type")]
45    pub tpe: String,
46    #[serde(rename = "generic-metadata-value")]
47    pub value: SetVariable<A>,
48}