class SuccessResponse:
    def __init__(self, data=None):
        self.code = 0
        self.msg = "Success"
        if data:
            self.data = data

    def to_dict(self):
        result = {"code": self.code, "msg": self.msg}
        if hasattr(self, "data"):
            result["data"] = self.data
        return result


class ErrorResponse:
    def __init__(self, data=None):
        self.code = -1
        self.msg = "Error"
        if data:
            self.data = data

    def to_dict(self):
        result = {"code": self.code, "msg": self.msg}
        if hasattr(self, "data"):
            result["data"] = self.data
        return result


__all__ = ["SuccessResponse", "ErrorResponse"]
