#![allow(dead_code)]
use async_trait::async_trait;
use crate::models::QueuedOutput;
use anyhow::Result;

#[async_trait]
pub trait Dispatcher: Send + Sync {
    async fn dispatch(&self, output: &QueuedOutput) -> Result<()>;
    fn target_name(&self) -> &str;
}

pub struct ConsoleDispatcher;

#[async_trait]
impl Dispatcher for ConsoleDispatcher {
    async fn dispatch(&self, output: &QueuedOutput) -> Result<()> {
        println!("--- Console Dispatch ---");
        println!("Target: {}", output.target);
        println!("Content: {}", output.content);
        println!("Metadata: {:?}", output.metadata);
        println!("------------------------");
        Ok(())
    }

    fn target_name(&self) -> &str {
        "console"
    }
}
