package editor

import (
	"git.gophernest.net/azpect/TextEditor/internal/action"
	"github.com/charmbracelet/lipgloss"
)

func (m Model) cursorStyle() lipgloss.Style {
	switch m.mode {
	case action.NormalMode,
		action.VisualMode,
		action.VisualBlockMode,
		action.VisualLineMode:
		// Block cursor for normal mode
		return lipgloss.NewStyle().Reverse(true)
	case action.InsertMode:
		// Bar/underline for insert mode
		return lipgloss.NewStyle().Underline(true)
	case action.CommandMode:
		return lipgloss.NewStyle().Reverse(true)
	default:
		return lipgloss.NewStyle().Reverse(true)
	}
}

// DEBUGGING STYLE
func (m Model) visualAnchorStyle() lipgloss.Style {
	bg := lipgloss.Color("#a89020")
	return lipgloss.NewStyle().Background(bg)
}

func (m Model) gutterStyle(currentLine bool) lipgloss.Style {
	bg := lipgloss.Color("236")
	fg := lipgloss.Color("243")
	if currentLine {
		fg = lipgloss.Color("#d69d00")
	}
	return lipgloss.NewStyle().
		Width(m.Settings().GutterSize).
		Background(bg).
		Foreground(fg)
}

func (m Model) visualHighlightStyle() lipgloss.Style {
	bg := lipgloss.Color("#7a6a00")
	return lipgloss.NewStyle().Background(bg)
}

func (m Model) commandErrorStyle() lipgloss.Style {
	fg := lipgloss.Color("#e3203a")
	return lipgloss.NewStyle().Foreground(fg)
}
