From 0a42a4fabcade3afe2692e45effb8657d231092b Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Sun, 24 Oct 2021 23:27:18 +0200 Subject: [PATCH] enumify light architype --- src/api/mod.rs | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/api/mod.rs b/src/api/mod.rs index f9dbf5d..cff0297 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -47,12 +47,52 @@ pub struct Light { #[derive(Debug, Clone, Deserialize)] pub struct LightConfig { - pub archetype: String, + pub archetype: LightArchetype, pub function: String, pub direction: String, pub startup: LightStartupConfig, } +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum LightArchetype { + Bollard, + Candlebulb, + Ceilinground, + Ceilingsquare, + Christmastree, + Classicbulb, + Doublespot, + Flexiblelamp, + Floodbulb, + Floorlantern, + Floorshade, + Groundspot, + Huebloom, + Huecentris, + Huego, + Hueiris, + Huelightstrip, + Huelightstriptv, + Hueplay, + Pendantlong, + Pendantround, + Recessedceiling, + Recessedfloor, + Singlespot, + Spotbulb, + Sultanbulb, + Tableshade, + Tablewash, + Vintagebulb, + Walllantern, + Wallshade, + Wallspot, + + #[serde(other)] + Other, +} + #[derive(Debug, Clone, Deserialize)] pub struct LightStartupConfig { // TODO: find variants and use enum