package app

import "log"

// debugLog is a no-op unless EnableDebugLog is called from main (when the
// CORREX_TUI_LOG env var is set). Tracing must never write to stderr while the
// alt-screen is active, so it is routed through the standard logger which main
// points at a file via tea.LogToFile.
var debugLog = func(string, ...any) {}

// EnableDebugLog switches tracing on, sending it through the standard logger.
func EnableDebugLog() { debugLog = log.Printf }

func (d DisplayState) String() string {
	switch d {
	case StateIdle:
		return "Idle"
	case StateInSession:
		return "InSession"
	case StateApproval:
		return "Approval"
	default:
		return "?"
	}
}

func (i InputMode) String() string {
	switch i {
	case ModeRouter:
		return "Router"
	case ModeFilter:
		return "Filter"
	default:
		return "?"
	}
}

func (e EditMode) String() string {
	switch e {
	case ModeNormal:
		return "Normal"
	case ModeInsert:
		return "Insert"
	default:
		return "?"
	}
}
