from sysactions import (
    StopAction,
    get_custom,
    get_model,
    show_messagebox,
)


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

    model = get_model(posid=pos_id)
    user_id = get_custom(
        model=model,
        key="Last Manager ID",
    )

    if user_id is None:
        show_messagebox(
            posid=pos_id,
            message="$USER_NOT_FOUND_PLEASE_AUTHENTICATE_MENU_AGAIN",
        )
        raise StopAction()

    return user_id
