konnektoren_core/challenges/placeholder/
mod.rs1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
5pub struct Placeholder {
6 pub id: String,
8 pub name: String,
10 pub description: String,
12 #[serde(rename = "type")]
14 pub type_: PlaceholderType,
15 pub image: Option<String>,
17 pub estimated_time: Option<String>,
19 pub text: Vec<InformativeText>,
21}
22
23impl Default for Placeholder {
24 fn default() -> Self {
25 let data = include_str!("../../../assets/placeholder_default.yml");
26 serde_yaml::from_str(data).unwrap()
27 }
28}
29
30#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
31pub enum PlaceholderType {
32 ComingSoon,
33 Planned,
34 UnderDevelopment,
35}
36
37#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
38pub struct InformativeText {
39 pub language: String,
41 pub text: String,
43}
44
45#[cfg(test)]
46mod tests {
47 use super::*;
48
49 #[test]
50 fn default() {
51 let dataset = Placeholder::default();
52 assert_eq!(dataset.id, "placeholder-adjective-declension");
53 assert_eq!(dataset.name, "Coming Soon: Adjective Declension");
54 assert_eq!(dataset.type_, PlaceholderType::ComingSoon);
55 }
56}