1use chrono::NaiveDateTime;
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Debug, Clone)]
6pub struct AuthResponse {
7 pub token: String,
8}
9
10#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
12pub struct ChatSendMessageResponse {
13 pub status: String,
14 pub message: String,
15}
16
17#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
18pub struct User {
19 pub authority: String,
20 pub username: String,
21 pub profile_photo_url: Option<String>,
22 pub updated_at: NaiveDateTime,
23 pub risk_score: i64,
24 pub is_banned: bool,
25 pub role: Option<String>,
26}
27
28#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
31pub struct ChatNotification {
32 pub authority: String,
33 pub username: String,
34 pub text: String,
35 pub id: u64,
36 pub ts: i64,
37 pub profile_photo_url: Option<String>,
38 pub role: Option<String>,
39}
40
41#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
42pub struct ResetNotification {
43 pub block_id: u64,
44}
45
46#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
47pub enum Notification {
48 Chat(ChatNotification),
49 Reset(ResetNotification),
50}
51
52impl Notification {
53 pub fn id(&self) -> String {
54 match self {
55 Notification::Chat(chat) => chat.id.to_string(),
56 Notification::Reset(reset) => reset.block_id.to_string(),
57 }
58 }
59}
60
61#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
62pub struct DailyRevenue {
63 pub day: String,
64 pub revenue: i64,
65}
66
67#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
70pub struct UsernameValidationResponse {
71 pub valid: bool,
72 pub error: Option<String>,
73}
74
75impl UsernameValidationResponse {
76 pub fn valid() -> Self {
77 Self {
78 valid: true,
79 error: None,
80 }
81 }
82
83 pub fn invalid(error: String) -> Self {
84 Self {
85 valid: false,
86 error: Some(error),
87 }
88 }
89}