# ---------- Logging ----------
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_PRINTK=y
CONFIG_NET_LOG=y
CONFIG_LOG_RUNTIME_FILTERING=y

# Shell over UART + log commands
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y
CONFIG_SHELL_STACK_SIZE=4096
CONFIG_SHELL_CMD_BUFF_SIZE=128
CONFIG_LOG_CMDS=y

# ---------- Peripherals ----------
CONFIG_SPI=y
CONFIG_GPIO=y

# ---------- Networking ----------
CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_ETH_W5500=y

CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_MGMT=y

# Optional but handy: `net` shell commands
CONFIG_NET_SHELL=y

# ---------- MQTT over TCP ----------
CONFIG_MQTT_LIB=y
CONFIG_MQTT_KEEPALIVE=60
CONFIG_MQTT_VERSION_5_0=y

# ---------- MQTT with TLS ----------
CONFIG_MQTT_LIB_TLS=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_TLS_LIBRARY=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_TLS_CREDENTIAL_FILENAMES=y
CONFIG_MBEDTLS_HEAP_SIZE=65536
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=4096

# ---------- Froce TLS 1.2 ----------
CONFIG_MBEDTLS_TLS_VERSION_1_2=y
CONFIG_MBEDTLS_TLS_VERSION_1_3=n

# Enable specific ciphersuites
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED=y
CONFIG_MBEDTLS_AES_C=y
CONFIG_MBEDTLS_CIPHER_MODE_CBC=y
CONFIG_MBEDTLS_CIPHER_MODE_CTR=y

# ---------- Buffers / stacks ----------
CONFIG_NET_BUF_TX_COUNT=32
CONFIG_NET_BUF_RX_COUNT=32
CONFIG_NET_BUF_DATA_SIZE=256

CONFIG_MAIN_STACK_SIZE=16384
CONFIG_NET_RX_STACK_SIZE=6144
CONFIG_NET_TX_STACK_SIZE=6144
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

# ---------- Safety ----------
CONFIG_HW_STACK_PROTECTION=y
CONFIG_STACK_SENTINEL=y
CONFIG_INIT_STACKS=y
CONFIG_THREAD_NAME=y
CONFIG_STACK_USAGE=y


# ---------- Other ----------
# Enable entropy
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

# Enable logging for TLS debugging
CONFIG_MBEDTLS_DEBUG=y
CONFIG_MBEDTLS_DEBUG_LEVEL=4
CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y
CONFIG_MBEDTLS_LOG_LEVEL_DBG=y


# Enable POSIX API and poll() support
CONFIG_POSIX_API=y
CONFIG_POLL=y
# pthread/ipc support (required by POSIX API in some builds)
# CONFIG_PTHREAD_IPC=y
# CONFIG_MAX_PTHREAD_COUNT=4