class CodedError(Exception):

    def __init__(
        self,       # type: CodedError
        code,       # type: int
        message,    # type: str
    ):
        # type: (...) -> None

        self.code = code
        self.message = message


class StartServiceError(object):

    POS_ID_IS_MANDATORY = CodedError(
        code=1,
        message="pos_id is mandatory",
    )


class TabServicePictureError(object):

    PARAMETER_NOT_FOUND = CodedError(
        code=-1,
        message="parameter not found",
    )

    INVALID_JSON = CodedError(
        code=-2,
        message="invalid json type for request",
    )

    REQUEST_NOT_A_DICT = CodedError(
        code=-3,
        message="input json be a dict",
    )

    EMPTY_DICT = CodedError(
        code=-4,
        message="input json dict must not be empty",
    )

    ANY_VALID_PARAM_FOUND = CodedError(
        code=-5,
        message="tab_id, tab_name or pos_id must exists",
    )

    TAB_ID_NOT_STRING = CodedError(
        code=-6,
        message="tab_id must be string",
    )

    TAB_NAME_NOT_STRING = CodedError(
        code=-7,
        message="tab_name must be string",
    )

    INVALID_TAB_NAME_FORMAT = CodedError(
        code=-8,
        message="tab_name format is invalid",
    )

    POS_ID_NOT_INT = CodedError(
        code=-9,
        message="pos_id must be int",
    )


class CreateTabFromSplitServiceError(object):

    PARSE_ERROR = CodedError(
        code=1,
        message="Error parsing SetTabNameRequest",
    )
