import 'package:json_annotation/json_annotation.dart';

part 'base_response.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class BaseResponse<T> {
  @JsonKey(name: 'data')
  T? data;

  @JsonKey(name: 'code')
  int? code;

  @JsonKey(name: 'msg')
  String? message;

  BaseResponse(this.data, this.code, this.message);

  factory BaseResponse.fromJson(
      Map<String, dynamic> json, T Function(Object? json) fromJsonT) =>
      _$BaseResponseFromJson(json, fromJsonT);
}
