use std::{collections::HashMap};
use chrono::{DateTime, Utc};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]
pub struct ChannelMessage {
pub id: String, pub session_id: Option<String>, pub direction: MessageDirection, pub timestamp: DateTime<Utc>, pub channel: String, pub from: Participant, pub to: Vec<Participant>,
pub content: Option<MessageContent>, pub thread_id: Option<String>, pub reply_to_id: Option<String>, pub metadata: HashMap<String, Value>, }
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]
pub enum MessageDirection {
#[default]
Incoming,
Outgoing
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]
pub struct Participant {
pub id: String, pub display_name: Option<String>, pub channel_specific_id: Option<String>, }
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub enum MessageContent {
Text(String),
File(FileMetadata),
Media(MediaMetadata),
Event(Event),
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct FileMetadata {
pub file_name: String,
pub mime_type: String,
pub url: String, pub size_bytes: Option<u64>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct MediaMetadata {
pub kind: MediaType, pub file: FileMetadata,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub enum MediaType {
Image,
Video,
Audio,
Binary
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct Event {
pub event_type: String,
pub event_payload: Option<Value>
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct EventType {
pub event_type: String, pub description: String, pub payload_schema: Option<Value>, }
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]
pub struct ChannelCapabilities {
pub name: String, pub supports_sending: bool,
pub supports_receiving: bool,
pub supports_text: bool,
pub supports_files: bool,
pub supports_media: bool,
pub supports_events: bool,
pub supports_typing: bool,
pub supports_threading: bool,
pub supports_reactions: bool,
pub supports_call: bool,
pub supports_buttons: bool,
pub supports_links: bool,
pub supports_custom_payloads: bool,
pub supported_events: Vec<EventType>, }