Files
herocoordinator/src/models/message.rs
2025-08-21 15:38:04 +02:00

55 lines
1.2 KiB
Rust

use serde::{Deserialize, Serialize};
use crate::{
models::{Job, ScriptType},
time::Timestamp,
};
#[derive(Clone, Serialize, Deserialize)]
pub struct Message {
/// Unique ID for the message, set by the caller
id: u32,
/// Id of the actor who sent this message
caller_id: u32,
/// Id of the context in which this message was sent
context_id: u32,
message: String,
message_type: ScriptType,
message_format_type: MessageFormatType,
/// Seconds for the message to arrive at the destination
timeout: u32,
/// Seconds for the receiver to acknowledge receipt of the message
timeout_ack: u32,
/// Seconds for the receiver to send us a reply
timeout_result: u32,
job: Vec<Job>,
logs: Vec<Log>,
created_at: Timestamp,
updated_at: Timestamp,
status: MessageStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MessageType {
Job,
Chat,
Mail,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MessageStatus {
Dispatched,
Acknowledged,
Error,
Processed,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MessageFormatType {
Html,
Text,
Md,
}
type Log = String;