// Author: fengshengxiong
// Date: 2024/6/18
// Description: 基础模型

class BaseModel<T> {
  bool success;
  String? status;
  String? message;
  T? data;

  BaseModel({
    this.success = false,
    this.status,
    this.message,
    this.data,
  });

  factory BaseModel.fromMap(Map<String, dynamic> json, T Function(Map<String, dynamic>) fromJsonT) => BaseModel(
    success: json["status"] == 'Success' ? true : false,
    status: json["status"],
    message: json["message"],
    data: fromJsonT(json["data"]),
  );

  Map<String, dynamic> toMap() => {
    "success": success,
    "status": status,
    "message": message,
    "data": data,
  };
}
