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