import 'package:json_annotation/json_annotation.dart';

part 'gzkj_response.g.dart';

///国中康健响应
@JsonSerializable(genericArgumentFactories: true)
class GzkjResponse<T> {
  @JsonKey(name: "success")
  final bool? success;
  @JsonKey(name: "messagecode")
  final String? messagecode;
  @JsonKey(name: "message")
  final String? message;
  @JsonKey(name: "data")
  T? data;

  GzkjResponse({this.success, this.messagecode, this.message, this.data});

  factory GzkjResponse.fromJson(
      Map<String, dynamic> json, T Function(Object? json) fromJsonT) {
    return _$GzkjResponseFromJson(json, fromJsonT);
  }

  Map<String, dynamic> toJson(Object Function(T value) toJsonT) {
    return _$GzkjResponseToJson(this, toJsonT);
  }

  bool get isSuccess => success ?? false;
}
