Skip to main content

jacquard_api/place_stream/metadata/
content_warnings.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.metadata.contentWarnings
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8use jacquard_common::CowStr;
9
10#[allow(unused_imports)]
11use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
12use jacquard_derive::{IntoStatic, lexicon};
13use jacquard_lexicon::lexicon::LexiconDoc;
14use jacquard_lexicon::schema::LexiconSchema;
15
16#[allow(unused_imports)]
17use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
18use serde::{Serialize, Deserialize};
19/// The content contains information that can be used to identify a particular individual, such as a name, phone number, email address, physical address, or IP address.
20
21#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
22pub struct Pii;
23impl core::fmt::Display for Pii {
24    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
25        write!(f, "PII")
26    }
27}
28
29/// The content could be perceived as offensive due to the discussion or display of death.
30
31#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
32pub struct Death;
33impl core::fmt::Display for Death {
34    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
35        write!(f, "death")
36    }
37}
38
39/// The content contains a portrayal of the use or abuse of mind altering substances.
40
41#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
42pub struct DrugUse;
43impl core::fmt::Display for DrugUse {
44    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
45        write!(f, "drugUse")
46    }
47}
48
49/// The content contains violent actions of a fantasy nature, involving human or non-human characters in situations easily distinguishable from real life.
50
51#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
52pub struct FantasyViolence;
53impl core::fmt::Display for FantasyViolence {
54    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
55        write!(f, "fantasyViolence")
56    }
57}
58
59/// The content contains flashing lights that could be harmful to viewers with seizure disorders such as photosensitive epilepsy.
60
61#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
62pub struct FlashingLights;
63impl core::fmt::Display for FlashingLights {
64    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
65        write!(f, "flashingLights")
66    }
67}
68
69/// The content could be perceived as offensive due to the language used.
70
71#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
72pub struct Language;
73impl core::fmt::Display for Language {
74    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
75        write!(f, "language")
76    }
77}
78
79/// Content warnings for a stream.
80
81#[lexicon]
82#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
83#[serde(rename_all = "camelCase")]
84pub struct ContentWarnings<'a> {
85    #[serde(skip_serializing_if = "Option::is_none")]
86    #[serde(borrow)]
87    pub warnings: Option<Vec<CowStr<'a>>>,
88}
89
90/// The content could be perceived as offensive due to nudity.
91
92#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
93pub struct Nudity;
94impl core::fmt::Display for Nudity {
95    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
96        write!(f, "nudity")
97    }
98}
99
100/// The content could be perceived as offensive due to the discussion or display of sexuality.
101
102#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
103pub struct Sexuality;
104impl core::fmt::Display for Sexuality {
105    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
106        write!(f, "sexuality")
107    }
108}
109
110/// The content could be perceived as distressing due to the discussion or display of suffering or triggering topics, including suicide, eating disorders or self harm.
111
112#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
113pub struct Suffering;
114impl core::fmt::Display for Suffering {
115    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
116        write!(f, "suffering")
117    }
118}
119
120/// The content could be perceived as offensive due to the discussion or display of violence.
121
122#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
123pub struct Violence;
124impl core::fmt::Display for Violence {
125    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
126        write!(f, "violence")
127    }
128}
129
130impl<'a> LexiconSchema for ContentWarnings<'a> {
131    fn nsid() -> &'static str {
132        "place.stream.metadata.contentWarnings"
133    }
134    fn def_name() -> &'static str {
135        "main"
136    }
137    fn lexicon_doc() -> LexiconDoc<'static> {
138        lexicon_doc_place_stream_metadata_contentWarnings()
139    }
140    fn validate(&self) -> Result<(), ConstraintError> {
141        Ok(())
142    }
143}
144
145fn lexicon_doc_place_stream_metadata_contentWarnings() -> LexiconDoc<'static> {
146    #[allow(unused_imports)]
147    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
148    use jacquard_lexicon::lexicon::*;
149    use alloc::collections::BTreeMap;
150    LexiconDoc {
151        lexicon: Lexicon::Lexicon1,
152        id: CowStr::new_static("place.stream.metadata.contentWarnings"),
153        defs: {
154            let mut map = BTreeMap::new();
155            map.insert(
156                SmolStr::new_static("PII"),
157                LexUserType::Token(LexToken { ..Default::default() }),
158            );
159            map.insert(
160                SmolStr::new_static("death"),
161                LexUserType::Token(LexToken { ..Default::default() }),
162            );
163            map.insert(
164                SmolStr::new_static("drugUse"),
165                LexUserType::Token(LexToken { ..Default::default() }),
166            );
167            map.insert(
168                SmolStr::new_static("fantasyViolence"),
169                LexUserType::Token(LexToken { ..Default::default() }),
170            );
171            map.insert(
172                SmolStr::new_static("flashingLights"),
173                LexUserType::Token(LexToken { ..Default::default() }),
174            );
175            map.insert(
176                SmolStr::new_static("language"),
177                LexUserType::Token(LexToken { ..Default::default() }),
178            );
179            map.insert(
180                SmolStr::new_static("main"),
181                LexUserType::Object(LexObject {
182                    description: Some(
183                        CowStr::new_static("Content warnings for a stream."),
184                    ),
185                    properties: {
186                        #[allow(unused_mut)]
187                        let mut map = BTreeMap::new();
188                        map.insert(
189                            SmolStr::new_static("warnings"),
190                            LexObjectProperty::Array(LexArray {
191                                items: LexArrayItem::String(LexString {
192                                    ..Default::default()
193                                }),
194                                ..Default::default()
195                            }),
196                        );
197                        map
198                    },
199                    ..Default::default()
200                }),
201            );
202            map.insert(
203                SmolStr::new_static("nudity"),
204                LexUserType::Token(LexToken { ..Default::default() }),
205            );
206            map.insert(
207                SmolStr::new_static("sexuality"),
208                LexUserType::Token(LexToken { ..Default::default() }),
209            );
210            map.insert(
211                SmolStr::new_static("suffering"),
212                LexUserType::Token(LexToken { ..Default::default() }),
213            );
214            map.insert(
215                SmolStr::new_static("violence"),
216                LexUserType::Token(LexToken { ..Default::default() }),
217            );
218            map
219        },
220        ..Default::default()
221    }
222}