import os

import cfgtools

show_invalid_customer_name_message = None
numpad_for_customer_name = None


def must_show_invalid_customer_name_message():
    # type: (...) -> bool

    global show_invalid_customer_name_message

    if show_invalid_customer_name_message is not None:
        return show_invalid_customer_name_message

    config = cfgtools.read(os.environ["LOADERCFG"])
    show_invalid_customer_name_message_config = config.find_value("Customer.ShowInvalidCustomerNameMessage")
    show_invalid_customer_name_message = (show_invalid_customer_name_message_config or "false").lower() == "true"

    return show_invalid_customer_name_message


def show_numpad_for_customer_name():
    # type: (...) -> bool

    global numpad_for_customer_name

    if numpad_for_customer_name is None:
        config = cfgtools.read(os.environ["LOADERCFG"])
        show_numpad_config = config.find_value("Customer.ShowNumpadForCustomerName")
        numpad_for_customer_name = (show_numpad_config or "false").lower() == "true"

    return numpad_for_customer_name
