package services
|
|
import (
|
"voicesnap/internal/axinput"
|
"voicesnap/internal/logger"
|
"voicesnap/internal/textoutput"
|
)
|
|
// TextOutputService exposes the latest production output result and explicit
|
// clipboard fallback actions. It never auto-pastes fallback text.
|
type TextOutputService struct {
|
router *textoutput.Router
|
}
|
|
func NewTextOutputService(router *textoutput.Router) *TextOutputService {
|
return &TextOutputService{router: router}
|
}
|
|
func (s *TextOutputService) GetLastResult() textoutput.Result {
|
if s.router == nil {
|
return textoutput.Result{OK: false, Method: "text_output_router", Message: "text output router is unavailable"}
|
}
|
return s.router.LastResult()
|
}
|
|
func (s *TextOutputService) PrepareLastClipboardFallback() axinput.ClipboardResult {
|
if s.router == nil {
|
return axinput.ClipboardResult{OK: false, Message: "text output router is unavailable"}
|
}
|
logger.Info("Text output fallback prepare service called")
|
result := s.router.PrepareLastClipboardFallback()
|
logger.Info(
|
"Text output fallback prepare service returned ok=%t prepared=%t token_present=%t",
|
result.OK,
|
result.Prepared,
|
result.Token != "",
|
)
|
return result
|
}
|
|
func (s *TextOutputService) RestoreClipboardFallback(token string) axinput.ClipboardResult {
|
if s.router == nil {
|
return axinput.ClipboardResult{OK: false, Message: "text output router is unavailable"}
|
}
|
logger.Info("Text output fallback restore service called token_present=%t", token != "")
|
result := s.router.RestoreClipboardFallback(token)
|
logger.Info(
|
"Text output fallback restore service returned ok=%t restored=%t token_present=%t",
|
result.OK,
|
result.Restored,
|
token != "",
|
)
|
return result
|
}
|