# Copyright (c) 2024 Afiq Zudin Hadi
# SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0

menuconfig STENO_ENGINE
	bool "Steno Engine"
	default n
	help
	  Enable the stenography engine for ZMK.

if STENO_ENGINE

choice STENO_DICT
	prompt "Steno dictionary"
	default STENO_DICT_PLOVER

config STENO_DICT_PLOVER
	bool "Plover main dictionary (MPHF compressed)"
	help
	  Use Plover main.json via MPHF compression.

config STENO_DICT_LAPWING
	bool "Lapwing dictionary (MPHF compressed)"

config STENO_DICT_TEST
	bool "Test dictionary (46 entries, simple format)"
	help
	  Small built-in test dictionary for development.

endchoice

config STENO_DICT_MPHF
	bool
	default y if STENO_DICT_PLOVER || STENO_DICT_LAPWING
	select ZLIB
	help
	  Use MPHF (minimal perfect hash) dictionary format.
	  Selects ZLIB for block-compressed string table decompression.

config STENO_CUSTOM_KEYMAP
	bool "Custom steno keymap"
	default n

choice STENO_UNICODE_MODE
	prompt "Unicode output mode"
	default STENO_UNICODE_MODE_NONE

config STENO_UNICODE_MODE_NONE
	bool "None (HID only)"

config STENO_UNICODE_MODE_LINUX
	bool "Linux (IBus)"

config STENO_UNICODE_MODE_MACOS
	bool "macOS"

config STENO_UNICODE_MODE_WINC
	bool "Windows (WinCompose)"

endchoice

config STENO_HISTORY_SIZE
	int "Stroke history size (undo depth)"
	default 100
	range 10 500

config STENO_KEY_DELAY_MS
	int "Key output delay (ms)"
	default 0
	range 0 50

config STENO_MULTI_STROKE_TIMEOUT_MS
	int "Multi-stroke timeout (ms)"
	default 500
	range 100 5000

config STENO_DICT_MAX_SIZE
	int "Max dictionary binary size (bytes)"
	default 473088
	help
	  Max compiled dict size. 473088 = 462KB.
	  Build fails if dict exceeds this — no trimming.

menuconfig STENO_SPLIT_DICT
	bool "Split dictionary across both halves"
	default n
	select STENO_DICT_MPHF
	help
	  Partition the steno dictionary across both keyboard halves.
	  Left (central) gets highest-importance entries for zero-latency
	  local lookup. Right (peripheral) gets remaining entries, queried
	  over BLE on local miss. Both halves have their own MPHF dict.

if STENO_SPLIT_DICT

config STENO_DICT_LEFT_MAX_SIZE
	int "Left half dict budget (bytes)"
	default 153600
	help
	  Flash budget for left (central) partition. Default 150KB.
	  Central has more code overhead (behavior, formatter, output,
	  undo, BLE client) so gets a smaller dict partition.
	  Highest-importance entries fill this first.

config STENO_DICT_RIGHT_MAX_SIZE
	int "Right half dict budget (bytes)"
	default 512000
	help
	  Flash budget for right (peripheral) partition. Default 500KB.
	  Peripheral has less code overhead so gets the bulk of the dict.
	  Remaining entries after left partition is filled.

config STENO_SPLIT_CACHE_SIZE
	int "LRU cache entries on central side"
	default 64
	range 16 512

config STENO_SPLIT_PREFETCH
	bool "Prefetch common follow-up strokes"
	default y

config STENO_SPLIT_TIMEOUT_MS
	int "BLE lookup timeout (ms)"
	default 50
	range 10 500

config STENO_SPLIT_LOG_LEVEL
	int "Split dict log level"
	default 3

endif # STENO_SPLIT_DICT

endif # STENO_ENGINE
