1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
7pub struct PanelKind(pub String);
8
9impl PanelKind {
10 pub fn new(kind: impl Into<String>) -> Self {
11 Self(kind.into())
12 }
13}
14
15#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
19pub struct PanelKey {
20 pub kind: PanelKind,
21 #[serde(default, skip_serializing_if = "Option::is_none")]
22 pub instance: Option<String>,
23}
24
25impl PanelKey {
26 pub fn new(kind: impl Into<String>) -> Self {
27 Self {
28 kind: PanelKind::new(kind),
29 instance: None,
30 }
31 }
32
33 pub fn with_instance(kind: impl Into<String>, instance: impl Into<String>) -> Self {
34 Self {
35 kind: PanelKind::new(kind),
36 instance: Some(instance.into()),
37 }
38 }
39}