1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use std::fmt::Display;

use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct UserResponse {
    pub status: String,
    pub message: String,
    pub user: User,
}

#[derive(Deserialize, Debug, Clone)]
pub struct User {
    #[serde(rename = "userID")]
    pub user_id: String,
    #[serde(rename = "totalRamMb")]
    pub total_ram: u32,
    #[serde(rename = "ramUsedMb")]
    pub used_ram: u32,
    pub subdomains: Vec<String>,
    #[serde(rename = "customdomains")]
    pub custom_domains: Vec<String>,
    pub apps: Vec<String>,
    pub plan: String,
    pub locale: String,
    #[serde(rename = "planDataEnd")]
    pub plan_date_end: String,
}

#[derive(Deserialize, Debug)]
pub struct LocaleResponse {
    pub status: String,
    pub locale: Locale,
}

#[derive(Deserialize, Debug, Clone)]
pub enum Locale {
    #[serde(rename = "pt-BR")]
    PtBR,
    #[serde(rename = "en-US")]
    EnUS,
}

impl Display for Locale {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::PtBR => write!(f, "pt-BR"),
            Self::EnUS => write!(f, "en-US"),
        }
    }
}