konnektoren_core/challenges/placeholder/
mod.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
5pub struct Placeholder {
6    /// Unique identifier for the placeholder
7    pub id: String,
8    /// Display name of the placeholder
9    pub name: String,
10    /// Description of what's coming
11    pub description: String,
12    /// Type of placeholder
13    #[serde(rename = "type")]
14    pub type_: PlaceholderType,
15    /// Optional image identifier
16    pub image: Option<String>,
17    /// Estimated time for completion
18    pub estimated_time: Option<String>,
19    /// Informative text content
20    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    /// Language code
40    pub language: String,
41    /// The text content
42    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}