ollie 0.2.5

This library serves as an abstraction layer on top of lapin, making it more intuitive and aligned with the structure of traditional HTTP API routing. By bridging the gap between message-based RabbitMQ operations and familiar API concepts, it simplifies the process of defining, managing, and handling message routes. The goal is to streamline message routing, making it easier for developers to create robust and scalable systems while leveraging the full capabilities of RabbitMQ.
Documentation
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,Serialize,Deserialize)]
pub struct TaskResult {
    pub task_id: String,
    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(),
        }
    }
}