1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#![deny(clippy::cargo)]
use serde::{Serialize, Deserialize};

#[derive(Deserialize, Serialize)]
pub struct User {
    pub id: i64,
    pub name: String,
}

#[derive(Deserialize, Serialize)]
pub struct MessageCreate {
    pub contents: String,
}

#[derive(Serialize, Deserialize)]
pub struct UserCreate {
    pub email: String,
    pub name: String,
    pub password: String,
    pub pubkey: String,
    pub privkey: String,
    pub security_level: UserSecurityLevel
}

#[derive(Serialize, Deserialize)]
pub enum UserSecurityLevel {
    Max,
    Reasonable,
    Low,
}

impl ToString for UserSecurityLevel {
    fn to_string(&self) -> String {
        match self {
            Self::Max => "Max".to_string(),
            Self::Reasonable => "Reasonable".to_string(),
            Self::Low => "Low".to_string(),
        }
    }
}