//! Concrete subscriber stubs for the event bus.

use super::Stage;
use super::events::{TransitionFired, TransitionSubscriber};
#[allow(unused_imports)]
use super::{event_label, stage_dir_name, stage_label};

// ── Subscriber stubs (real dispatch uses these as the interface) ─────────────
//
// These are ready to wire into the event bus but not yet connected to the
// actual subsystems. Suppress dead_code until consumers are migrated.

#[allow(dead_code)]
pub struct MatrixBotSubscriber;
#[allow(dead_code)]
impl TransitionSubscriber for MatrixBotSubscriber {
    fn name(&self) -> &'static str {
        "matrix-bot"
    }
    fn on_transition(&self, f: &TransitionFired) {
        crate::slog!(
            "[pipeline/matrix-bot] #{}: {} → {}",
            f.story_id,
            stage_label(&f.before),
            stage_label(&f.after)
        );
    }
}

#[allow(dead_code)]
pub struct FileRendererSubscriber;
#[allow(dead_code)]
impl TransitionSubscriber for FileRendererSubscriber {
    fn name(&self) -> &'static str {
        "filesystem"
    }
    fn on_transition(&self, f: &TransitionFired) {
        crate::slog!(
            "[pipeline/filesystem] re-rendering work/{}/{}",
            stage_dir_name(&f.after),
            f.story_id
        );
    }
}

#[allow(dead_code)]
pub struct PipelineItemsSubscriber;
#[allow(dead_code)]
impl TransitionSubscriber for PipelineItemsSubscriber {
    fn name(&self) -> &'static str {
        "pipeline-items"
    }
    fn on_transition(&self, f: &TransitionFired) {
        crate::slog!(
            "[pipeline/items] UPDATE stage = '{}' WHERE id = '{}'",
            stage_dir_name(&f.after),
            f.story_id
        );
    }
}

#[allow(dead_code)]
pub struct AutoAssignSubscriber;
#[allow(dead_code)]
impl TransitionSubscriber for AutoAssignSubscriber {
    fn name(&self) -> &'static str {
        "auto-assign"
    }
    fn on_transition(&self, f: &TransitionFired) {
        if matches!(f.after, Stage::Done { .. } | Stage::Archived { .. }) {
            crate::slog!(
                "[pipeline/auto-assign] story {} reached {}; checking for promotable backlog items",
                f.story_id,
                stage_label(&f.after)
            );
        }
    }
}

#[allow(dead_code)]
pub struct WebUiBroadcastSubscriber;
#[allow(dead_code)]
impl TransitionSubscriber for WebUiBroadcastSubscriber {
    fn name(&self) -> &'static str {
        "web-ui-broadcast"
    }
    fn on_transition(&self, f: &TransitionFired) {
        crate::slog!(
            "[pipeline/web-ui] broadcasting #{} transition to connected clients",
            f.story_id
        );
    }
}
