use crate::pipeline::callbacks::Callbacks;
use crate::pipeline::stage::StageSpec;

pub struct NodeRequest {
    pub key: String,
    pub generation_id: u64,
    pub stage: StageSpec,
    pub callbacks: Box<dyn Callbacks>,
}

impl std::fmt::Debug for NodeRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("NodeRequest")
            .field("key", &self.key)
            .field("generation_id", &self.generation_id)
            .field("stage", &self.stage)
            .field("callbacks", &"<Callbacks>")
            .finish()
    }
}

impl NodeRequest {
    pub fn new(
        key: impl Into<String>,
        generation_id: u64,
        stage: StageSpec,
        callbacks: Box<dyn Callbacks>,
    ) -> Self {
        NodeRequest {
            key: key.into(),
            generation_id,
            stage,
            callbacks,
        }
    }
}
