hvz/groupchat.rs
1use crate::establish_connection;
2
3/// Represents a group chat.
4pub struct GroupChat {
5 id: String,
6 name: String,
7}
8
9pub enum GroupRole {
10 Admin,
11 Member,
12}
13
14/// Represents a member of a group chat.
15pub struct GroupMember {
16 id: String,
17 group_id: String,
18 player_id: String,
19 status: GroupRole,
20}
21
22impl GroupChat {
23 /// Create a new group chat with the given ID, name, and members.
24 ///
25 /// # Arguments
26 /// * `id` - The unique identifier for the group chat.
27 /// * `name` - The name of the group chat.
28 /// * `members` - The list of members in the group chat.
29 ///
30 /// # Returns
31 ///
32 /// A new instance of `GroupChat`.
33 pub fn new(id: String, name: String) -> Self {
34 Self { id, name }
35 }
36
37 /// Add a member to the group chat.
38 ///
39 /// # Arguments
40 /// * `member` - The member to add to the group chat.
41 ///
42 /// # Returns
43 ///
44 /// The updated group chat.
45 pub fn add_member(mut self, member: GroupMember) -> Self {
46 let connection = &mut establish_connection();
47 self
48 }
49
50 /// Get the list of members in the group chat.
51 ///
52 /// # Returns
53 ///
54 /// The list of member IDs.
55 pub fn get_members(&self) -> Result<&Vec<String>, String> {
56 let connection = &mut establish_connection();
57 Err("not implemented".to_string())
58 }
59
60 /// Remove a member from the group chat.
61 ///
62 /// # Arguments
63 /// * `member_id` - The ID of the member to remove.
64 ///
65 /// # Returns
66 ///
67 /// The updated group chat.
68 pub fn remove_member(mut self, member_id: &str) -> Self {
69 self
70 }
71}