from flask import jsonify
import json


class Resp:

    def __init__(self, status, code, data):
        self.status = status
        self.code = code
        self.data = data

    # def __str__(self):
    #     return json.dumps(dict(self))

    @staticmethod
    def ok(data):
        return jsonify(Resp("success", 200, data).__dict__)

    @staticmethod
    def err(data):
        return jsonify(Resp("fail", 500, data).__dict__)


if __name__ == '__main__':
    # print(Resp("success", 200, "dadas"))
    pass
