import 'package:json_annotation/json_annotation.dart';

part 'base_page.g.dart';

@JsonSerializable(includeIfNull: false)
class BasePage extends Object {
  @JsonKey(name: 'PageNumber')
  int page;

  @JsonKey(name: 'PageSize')
  int limit;

  @JsonKey(name: 'PageIndex')
  int? _pageIndex;

  BasePage(this.page, this.limit) : _pageIndex = page;

  // ignore: non_constant_identifier_names
  int get PageIndex => page;

  set PageIndex(int newValue) {
    _pageIndex = newValue;
    page = newValue;
  }

  factory BasePage.fromJson(Map<String, dynamic> srcJson) {
    return _$BasePageFromJson(srcJson);
  }

  Map<String, dynamic> toJson() {
    return _$BasePageToJson(this);
  }
}
