package main

import (
	"flag"
	"fmt"
	"os"

	"termdoku/internal/config"
	"termdoku/internal/theme"
	"termdoku/internal/ui"

	tea "github.com/charmbracelet/bubbletea"
)

func main() {
	// Legacy flags kept but ignored when menu is used
	_ = flag.Bool("daily", false, "Generate daily puzzle")
	_ = flag.String("difficulty", "normal", "Difficulty: easy|normal|hard|lunatic")
	flag.Parse()

	// Create example theme on first run (if it doesn't exist)
	_ = theme.CreateExampleTheme()

	cfg, _ := config.Load()
	app := ui.NewApp(cfg)
	if _, err := tea.NewProgram(app, tea.WithAltScreen()).Run(); err != nil {
		fmt.Fprintln(os.Stderr, "ui error:", err)
		os.Exit(1)
	}
}
