1use std::collections::HashSet;
2
3use serde::{Deserialize, Serialize};
4
5use super::{EventId, UserId};
6
7#[derive(Debug, Serialize, Deserialize, Clone)]
8pub struct User {
9 pub id: UserId,
10 pub name: String,
11 pub events: HashSet<EventId>,
12}
13impl User {
14 pub fn new(id: UserId, name: &str) -> Self {
15 Self {
16 id,
17 name: String::from(name),
18 events: HashSet::new(),
19 }
20 }
21}
22impl PartialEq for User {
23 fn eq(&self, other: &Self) -> bool {
24 self.id == other.id
25 }
26}
27impl Eq for User {}