import 'package:dio/dio.dart';
/// 基础返回类
/// <BaseResp<T> 返回 success code message data.
class BaseResp<T> {
  bool success;
  int code;
  String message;
  dynamic data;

  BaseResp(this.success, this.code, this.message, this.data);

  @override
  String toString() {
    StringBuffer sb = new StringBuffer('{');
    sb.write("\"success\":\"$success\"");
    sb.write(",\"code\":$code");
    sb.write(",\"message\":\"$message\"");
    sb.write(",\"data\":\"$data\"");
    sb.write('}');
    return sb.toString();
  }
}

/// <BaseRespR<T> 返回 success code message data Response.
class BaseRespR<T> {
  bool success;
  int code;
  String message;
  dynamic data;
  Response response;

  BaseRespR(this.success, this.code, this.message, this.data, this.response);

  @override
  String toString() {
    StringBuffer sb = new StringBuffer('{');
    sb.write("\"success\":\"$success\"");
    sb.write(",\"code\":$code");
    sb.write(",\"message\":\"$message\"");
    sb.write(",\"data\":\"$data\"");
    sb.write('}');
    return sb.toString();
  }
}
