// Package handlers re-exports generation job handlers from the shared package.
// The worker registers these handlers to process queue jobs.
package handlers

import (
	"git.threesix.ai/jordan/persona-community-5/pkg/generation"
	"git.threesix.ai/jordan/persona-community-5/pkg/logging"
	"git.threesix.ai/jordan/persona-community-5/pkg/mediagen"
	"git.threesix.ai/jordan/persona-community-5/pkg/personagen"
	"git.threesix.ai/jordan/persona-community-5/pkg/queue"
	"git.threesix.ai/jordan/persona-community-5/pkg/realtime"
	"git.threesix.ai/jordan/persona-community-5/pkg/storage"
	"git.threesix.ai/jordan/persona-community-5/pkg/textgen"
)

// ImageHandler returns a queue.Handler that processes image generation jobs.
func ImageHandler(mg *mediagen.Manager, store storage.Store, pub realtime.EventPublisher, logger *logging.Logger) queue.Handler {
	return generation.ImageHandler(mg, store, pub, logger)
}

// VideoHandler returns a queue.Handler that processes video generation jobs.
func VideoHandler(mg *mediagen.Manager, store storage.Store, pub realtime.EventPublisher, logger *logging.Logger) queue.Handler {
	return generation.VideoHandler(mg, store, pub, logger)
}

// TextHandler returns a queue.Handler that processes text generation jobs with streaming.
func TextHandler(tg *textgen.Manager, pub realtime.EventPublisher, logger *logging.Logger) queue.Handler {
	return generation.TextHandler(tg, pub, logger)
}

// ChatResponseHandler returns a queue.Handler that generates AI chat responses.
func ChatResponseHandler(tg *textgen.Manager, pub realtime.EventPublisher, logger *logging.Logger) queue.Handler {
	return generation.ChatResponseHandler(tg, pub, logger)
}

// PersonaGenerateHandler returns a queue.Handler for the staged persona generation pipeline.
// Each job carries a stage (spec, anchor, avatar, banner, gallery_batch, video) and processes
// one unit of work, updating the persona row and publishing SSE events after each stage.
func PersonaGenerateHandler(deps personagen.PipelineDeps) queue.Handler {
	return personagen.StagedQueueHandler(deps)
}
