1use super::user::{Metadata, User};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4use crate::model::channel::Channel;
5
6#[derive(Debug, Serialize, Deserialize, Clone)]
7pub struct Ready {
8 #[serde(rename = "type")]
9 pub _type: String,
10 pub channels: Vec<Channel>,
11 pub members: Vec<Member>,
12 pub servers: Vec<serde_json::Value>, pub users: Vec<User>,
14}
15
16#[derive(Debug, Serialize, Deserialize, Clone)]
17pub struct MemberId {
18 pub server: String,
19 pub user: String
20}
21#[derive(Clone, Debug, Serialize, Deserialize)]
22pub struct Member {
23 pub _id: MemberId,
24 pub joined_at: String,
25}
26
27
28
29
30
31#[derive(Debug, Serialize, Deserialize, Clone)]
32pub struct Status {
33 pub text: Option<String>,
34 pub presence: String
35}
36
37#[derive(Debug, Serialize, Deserialize, Clone)]
38pub struct Icon {
39 pub _id: String,
40 pub tag: String,
41 pub metadata: Metadata,
42 pub content_type: String,
43 pub size: usize,
44}
45
46#[derive(Debug, Serialize, Deserialize, Clone)]
47pub struct Server {
48 pub _id: String,
49 pub owner: String,
50 pub name: String,
51 pub description: String,
52 pub channels: Vec<String>,
53 pub categories: Vec<Category>,
54 pub system_messages: SystemMessages,
55 pub default_permissions: Option<serde_json::Value>,
56 pub icon: Option<Icon>,
57 pub roles: Option<Vec<HashMap<String, Role>>>,
58 pub banner: Option<Icon>,
59}
60#[derive(Debug, Serialize, Deserialize, Clone)]
61pub struct Role {
62 pub color: String,
63 pub hoist: bool,
64 pub name: String,
65 pub permissions: Vec<usize>,
66 pub rank: usize,
67}
68
69#[derive(Debug, Serialize, Deserialize, Clone)]
70pub struct SystemMessages {
71 pub user_joined: Option<String>,
72 pub user_left: Option<String>,
73 pub user_kicked: Option<String>,
74 pub user_banned: Option<String>,
75}
76
77#[derive(Debug, Serialize, Deserialize, Clone)]
78pub struct Category {
79 pub id: String,
80 pub title: String,
81 pub channels: Vec<String>,
82}