use std::collections::HashMap; use serde::Deserialize; #[derive(Debug, Clone, PartialEq, Deserialize)] #[serde(untagged)] pub enum CuddleBase { Bool(bool), String(String), } #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct CuddleShellScriptArgEnv { pub key: String, pub description: Option, } #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct CuddleShellScriptArgFlag { pub name: String, pub description: Option, pub required: Option, pub default_value: Option, } #[derive(Debug, Clone, PartialEq, Deserialize)] #[serde(tag = "type")] pub enum CuddleShellScriptArg { #[serde(alias = "env")] Env(CuddleShellScriptArgEnv), #[serde(alias = "flag")] Flag(CuddleShellScriptArgFlag), } #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct CuddleShellScript { pub description: Option, pub args: Option>, } #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct CuddleDaggerScript { pub description: Option, } #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct CuddleLuaScript { pub description: Option, } #[derive(Debug, Clone, PartialEq, Deserialize)] #[serde(tag = "type")] pub enum CuddleScript { #[serde(alias = "shell")] Shell(CuddleShellScript), #[serde(alias = "dagger")] Dagger(CuddleDaggerScript), #[serde(alias = "lua")] Lua(CuddleLuaScript), } #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct CuddlePlan { pub base: CuddleBase, pub vars: Option>, pub scripts: Option>, } #[derive(Debug, Clone)] #[allow(dead_code)] pub struct CuddleVariable { pub name: String, pub value: String, } impl CuddleVariable { pub fn new(name: String, value: String) -> Self { Self { name, value } } }