from msgbus import (
    TK_SYS_NAK,
    TK_CMP_MESSAGE,
    FM_PARAM,
)
from sysactions import send_message


def get_table_picture(
    pos_id,    # type: str
    table_id,  # type: str
):
    # type: (...) -> str

    params = ["TABLE_PICTURE", pos_id, table_id]
    req_buf = "\0".join([str(p) for p in params])
    result = send_message(
        dest_name="TABLEMGR",
        token=TK_CMP_MESSAGE,
        format=FM_PARAM,
        data=req_buf,
    )
    if result.token == TK_SYS_NAK:
        message = "Error getting table_picture"
        raise Exception(message)

    return result.data
