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
52
53
54
55
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use crate::api::models::Status;

use super::ChatType;

#[derive(Deserialize, Debug)]
pub struct StatusRequest {
    pub bot_id: Uuid,
    pub user_huid: Uuid,
    pub ad_login: Option<String>,
    pub ad_domain: Option<String>,
    pub is_admin: Option<bool>,
    pub chat_type: Option<ChatType>,
}

#[derive(Serialize, Debug, Clone, Builder)]
#[builder(setter(into, prefix = "with", strip_option))]
pub struct StatusResponse {
    /// Успешность обработки ответа “ok”|“error”
    pub status: Status,

    /// Ответ
    pub result: StatusResponseResult,
}

#[derive(Serialize, Debug, Clone, Builder)]
#[builder(setter(into, prefix = "with", strip_option))]
pub struct StatusResponseResult {
    /// Бот включен/выключен
    pub enabled: bool,

    /// Текущий статус бота
    #[builder(default)]
    pub status_message: Option<String>,

    /// Список команд бота 
    #[builder(default)]
    pub commands: Vec<BotCommand>,
}

/// Команда бота 
#[derive(Serialize, Debug, Clone, Builder)]
#[builder(setter(into, prefix = "with", strip_option))]
pub struct BotCommand {
    /// Описание команды
    pub description: String,

    /// Тело команды
    pub body: String,

    /// Имя команды
    pub name: String,
}