package flow

import (
	"fmt"
	"log"
)

func (f *Flow) linkKeyboard() {
	// Keyboard settings
	// TODO: implement keybindings save/load behaviour
	f.onClick(kbd, "3.1", f.returnToLastDriver(kbd)) // Done button
	f.onClick(kbd, "3.2", f.returnToLastDriver(kbd)) // Cancel button
	f.onClick(kbd, "3.4", func() {})                 // TODO: Reset to defaults button

	for i := 1; i <= 13; i++ {
		f.onClick(kbd, fmt.Sprintf("2.%v", i), f.captureKeybinding(i))
	}
}

func (f *Flow) captureKeybinding(forLine int) func() {
	return func() {
		log.Printf("HELLO %v", forLine)
		f.showDialogue(kbd, "4")()
	}
}
