use std::time::Duration;
use serde::{Deserialize, Serialize};
#[derive(Debug,Serialize,Deserialize)]
pub struct RabbitResult{
pub logging_level: LoggingLevel,
pub billing_type: BillingType,
pub task_result: TaskResult,
}
#[derive(Debug, Clone,Serialize,Deserialize)]
pub enum TaskId{
Id(String),
Unknown
}
#[derive(Debug,Serialize,Deserialize)]
pub struct TaskResult {
pub task_id: TaskId,
pub engine_metadata: EngineMetadata,
pub data: serde_json::Value,
}
#[derive(Debug,Serialize,Deserialize)]
pub struct EngineMetadata{
pub engine_id: String,
pub time_taken: Duration,
}
#[derive(Debug,Serialize,Deserialize)]
pub enum LoggingLevel {
Unlogged,
Debug,
Info,
Warning,
Error,
}
impl ToString for LoggingLevel {
fn to_string(&self) -> String {
match self {
LoggingLevel::Unlogged => "Unlogged".to_string(),
LoggingLevel::Debug => "Debug".to_string(),
LoggingLevel::Info => "Info".to_string(),
LoggingLevel::Warning => "Warning".to_string(),
LoggingLevel::Error => "Error".to_string(),
}
}
}
#[derive(Debug,Serialize,Deserialize)]
pub enum BillingType {
Prepaid,
Postpaid,
NotBilled,
}
impl ToString for BillingType {
fn to_string(&self) -> String {
match self {
BillingType::Prepaid => "Prepaid".to_string(),
BillingType::Postpaid => "Postpaid".to_string(),
BillingType::NotBilled => "NotBilled".to_string(),
}
}
}