1use chrono::NaiveDateTime;
2use serde::{Deserialize, Serialize};
3
4#[cfg(feature = "redis")]
5use redis_derive::{FromRedisValue, ToRedisArgs};
6
7#[derive(Serialize, Deserialize, Debug, Clone)]
9pub struct AuthResponse {
10 pub token: String,
11}
12
13#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
15pub struct ChatSendMessageResponse {
16 pub status: String,
17 pub message: String,
18}
19
20#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
21pub struct User {
22 pub authority: String,
23 pub username: String,
24 pub profile_photo_url: Option<String>,
25 pub discord_user: Option<DiscordUser>,
26 pub updated_at: NaiveDateTime,
27 pub risk_score: i64,
28 pub is_banned: bool,
29 pub role: Option<String>,
30}
31
32#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
35#[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs))]
36pub struct ChatNotification {
37 pub authority: String,
38 pub username: String,
39 pub text: String,
40 pub id: u64,
41 pub ts: i64,
42 pub profile_photo_url: Option<String>,
43 pub role: Option<String>,
44}
45
46#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
47pub struct ResetNotification {
48 pub block_id: u64,
49}
50
51#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
52pub enum Notification {
53 Chat(ChatNotification),
54 Reset(ResetNotification),
55}
56
57impl Notification {
58 pub fn id(&self) -> String {
59 match self {
60 Notification::Chat(chat) => chat.id.to_string(),
61 Notification::Reset(reset) => reset.block_id.to_string(),
62 }
63 }
64}
65
66#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
67pub struct DailyRevenue {
68 pub day: String,
69 pub revenue: i64,
70}
71
72#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
75pub struct UsernameValidationResponse {
76 pub valid: bool,
77 pub error: Option<String>,
78}
79
80impl UsernameValidationResponse {
81 pub fn valid() -> Self {
82 Self {
83 valid: true,
84 error: None,
85 }
86 }
87
88 pub fn invalid(error: String) -> Self {
89 Self {
90 valid: false,
91 error: Some(error),
92 }
93 }
94}
95
96#[derive(Serialize, Deserialize, Debug, Clone)]
98pub struct DiscordAuthResponse {
99 pub access_token: String,
100}
101
102#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
103pub struct DiscordUser {
104 pub id: String,
105 pub username: String,
106 pub discriminator: String,
107 #[serde(default, skip_serializing_if = "Option::is_none")]
108 pub global_name: Option<String>,
109 #[serde(default, skip_serializing_if = "Option::is_none")]
110 pub avatar: Option<String>,
111 #[serde(default, skip_serializing_if = "Option::is_none")]
112 pub verified: Option<bool>,
113 #[serde(default, skip_serializing_if = "Option::is_none")]
114 pub email: Option<String>,
115}
116
117#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
118pub struct OreBalance {
119 pub wallet: u64,
120 pub staked: u64,
121 pub unrefined: u64,
122 pub refined: u64,
123}