54
src/models/message.rs
Normal file
54
src/models/message.rs
Normal file
@@ -0,0 +1,54 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
models::{Job, ScriptType},
|
||||
time::Timestamp,
|
||||
};
|
||||
|
||||
#[derive(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(Serialize, Deserialize)]
|
||||
pub enum MessageType {
|
||||
Job,
|
||||
Chat,
|
||||
Mail,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum MessageStatus {
|
||||
Dispatched,
|
||||
Acknowledged,
|
||||
Error,
|
||||
Processed,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum MessageFormatType {
|
||||
Html,
|
||||
Text,
|
||||
Md,
|
||||
}
|
||||
|
||||
type Log = String;
|
Reference in New Issue
Block a user