import 'dart:convert';

class BaseEntity {
  int? code;
  int? result;
  String? message;
  dynamic data;

  // 构造函数
  BaseEntity({this.code, this.result, this.message, this.data});

  // 数据解析
  factory BaseEntity.fromJson(json) {
    dynamic data = json["content"][0]["text"];
    return BaseEntity(code: 0,data: data);
  }


  // 数据解析
  factory BaseEntity.PlayfromComfyUi(json) {
    Map<String, dynamic> responseData = json;
    String message = responseData["type"]; //错误描述
    dynamic data = responseData["name"];
    return BaseEntity(code: 0, result: 0, message: message, data: data);
  }

  // 数据解析
  factory BaseEntity.PlayfromJson(json) {
    Map<String, dynamic> responseData = json;
    int code = responseData["Code"];
    // int result = responseData["Result"];
    String message = responseData["Message"]; //错误描述
    dynamic data = responseData["Data"];
    return BaseEntity(code: code, result: 0, message: message, data: data);
  }
}

class ErrorEntity {
  int? code;
  String? message;

  ErrorEntity({this.code, this.message});
}
