1use std::time::Duration;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Default, Serialize, Deserialize)]
8pub enum AuthScope {
9 Public,
11 #[default]
12 Complete,
13}
14
15#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
17pub enum AuthDuration {
18 Short,
20 Medium,
22 #[default]
24 Long,
25}
26
27impl Into<Duration> for AuthDuration {
29 fn into(self) -> Duration {
30 match self {
31 Self::Short => Duration::from_secs(60 * 60),
32 Self::Medium => Duration::from_secs(24 * 60 * 60),
33 Self::Long => Duration::from_secs(30 * 24 * 60 * 60),
34 }
35 }
36}
37
38#[derive(Clone, Debug, Serialize, Deserialize)]
44pub struct AuthRequest {
45 pub email: String,
46 pub password: String,
47 pub scope: AuthScope,
50 pub term: AuthDuration,
52 pub context: String,
55}
56
57#[derive(Clone, Debug, Serialize, Deserialize)]
62pub struct AuthResponse {
63 pub token: String,
64}
65
66#[derive(Clone, Debug, Serialize, Deserialize)]
67pub struct MeResponse {
68 pub email: String,
69 pub name: String,
70 pub plan: String,
71}
72
73#[derive(Clone, Debug, Serialize, Deserialize)]
74pub struct CreditsAddRequest {
75 pub amount: u32,
76}
77#[derive(Clone, Debug, Serialize, Deserialize)]
78pub struct CreditsAddResponse {
79 pub resulting_balance: f32,
80}
81
82#[derive(Clone, Debug, Serialize, Deserialize)]
83pub struct DeployQuery {
84 pub name: String,
85 pub address: String,
86}