<commit_before>package menu

import (
	"encoding/json"
	"fmt"
	"net"
	"time"

	. "github.com/miketheprogrammer/thrust-go/src/commands"
	. "github.com/miketheprogrammer/thrust-go/src/common"
)

type Item interface {
	IsSubMenu() bool
	IsCommandId() bool
	Handle()
}

type MenuItem struct {
	CommandID int    `json:"command_id,omitempty"`
	Label     string `json:"label,omitempty"`
	GroupID   int    `json:"group_id,omitempty"`
	SubMenu   *Menu  `json:"submenu,omitempty"`
	Type      string `json:"type,omitempty"`
	Checked   bool   `json:"checked,omitempty"`
	Parent    *Menu  `json:"-"`
}

func (mi MenuItem) IsSubMenu() bool {
	return mi.SubMenu != nil
}

func (mi MenuItem) IsCommandId(commandID int) bool {
	return mi.CommandID == commandID
}

func (mi MenuItem) HandleEvent(conn net.Conn) {
	fmt.Println("EventType", mi.Type)
	switch mi.Type {
	case "check":
		fmt.Println("Toggling Checked(", mi.Checked, ")", "to", "checked(", !mi.Checked, ")")
		mi.Parent.SetChecked(mi.CommandID, !mi.Checked, false, conn)
	}
}

type Menu struct {
	TargetID         int         `json:"target_id,omitempty"`
	WaitingResponses []*Command  `json:"awaiting_responses,omitempty"`
	CommandQueue     []*Command  `json:"command_queue,omitempty"`
	Conn             net.Conn    `json:"-"`
	Ready            bool        `json:"ready"`
	Displayed        bool        `json:""displayed`
	Parent           *Menu       `json:"-"`
	Children         []*Menu     `json:"-"`
	Items            []*MenuItem `json:"items,omitempty"`
	EventRegistry    []int       `json:"events,omitempty"`
}
<commit_msg>Fix json marshaling error in menu where Display was capitalized<commit_after>package menu

import (
	"encoding/json"
	"fmt"
	"net"
	"time"

	. "github.com/miketheprogrammer/thrust-go/src/commands"
	. "github.com/miketheprogrammer/thrust-go/src/common"
)

type Item interface {
	IsSubMenu() bool
	IsCommandId() bool
	Handle()
}

type MenuItem struct {
	CommandID int    `json:"command_id,omitempty"`
	Label     string `json:"label,omitempty"`
	GroupID   int    `json:"group_id,omitempty"`
	SubMenu   *Menu  `json:"submenu,omitempty"`
	Type      string `json:"type,omitempty"`
	Checked   bool   `json:"checked,omitempty"`
	Parent    *Menu  `json:"-"`
}

func (mi MenuItem) IsSubMenu() bool {
	return mi.SubMenu != nil
}

func (mi MenuItem) IsCommandId(commandID int) bool {
	return mi.CommandID == commandID
}

func (mi MenuItem) HandleEvent(conn net.Conn) {
	fmt.Println("EventType", mi.Type)
	switch mi.Type {
	case "check":
		fmt.Println("Toggling Checked(", mi.Checked, ")", "to", "checked(", !mi.Checked, ")")
		mi.Parent.SetChecked(mi.CommandID, !mi.Checked, false, conn)
	}
}

type Menu struct {
	TargetID         int         `json:"target_id,omitempty"`
	WaitingResponses []*Command  `json:"awaiting_responses,omitempty"`
	CommandQueue     []*Command  `json:"command_queue,omitempty"`
	Conn             net.Conn    `json:"-"`
	Ready            bool        `json:"ready"`
	Displayed        bool        `json:"displayed"`
	Parent           *Menu       `json:"-"`
	Children         []*Menu     `json:"-"`
	Items            []*MenuItem `json:"items,omitempty"`
	EventRegistry    []int       `json:"events,omitempty"`
}

{'fraction_non_alphanumeric': 0.14786967418546365, 'fraction_numerical': 0.0, 'mean_word_length': 3.4224376731301938, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1951594', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1078, 'n_words': 233}