import 'package:json_annotation/json_annotation.dart';

part 'base_page_result.g.dart';

@JsonSerializable(genericArgumentFactories: true, fieldRename: FieldRename.snake)
class BasePageResult<T> extends Object {
  @JsonKey(name: 'Data')
  List<T> data;

  @JsonKey(name: 'Total')
  int total;

  BasePageResult(
    this.data,
    this.total,
  );

  factory BasePageResult.fromJson(Map<String, dynamic> json, T Function(dynamic json) fromJsonT) => _$BasePageResultFromJson(json, fromJsonT);

  Map<String, dynamic> toJson(Object Function(T value) toJsonT) => _$BasePageResultToJson(this, toJsonT);
}
