use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use uuid::Uuid;
use crate::{bot::models::{ChatType, UserKind}, api::models::{ChatNotFound, ErrorFromMessagingService}};
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ChatInfoResponse {
pub result: ChatInfoResult,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ChatInfoResult {
pub chat_type: ChatType,
pub creator: Uuid,
pub description: Option<String>,
pub group_chat_id: Uuid,
pub inserted_at: DateTime<Utc>,
pub members: Vec<ChatMember>,
pub name: String,
pub shared_history: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ChatMember {
pub admin: bool,
pub server_id: Uuid,
pub user_huid: Uuid,
pub user_kind: UserKind,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(tag = "reason")]
pub enum ChatInfoError {
#[serde(rename(serialize = "chat_not_found", deserialize = "chat_not_found"))]
ChatNotFound(ChatNotFound),
#[serde(rename(serialize = "error_from_messaging_service", deserialize = "error_from_messaging_service"))]
ErrorFromMessagingService(ErrorFromMessagingService),
#[serde(other)]
Other,
}