import '../../SessionLog.dart';

class SessionLogPage {
  int number;

  int size;

  int totalElements;

  int totalPages;

  int numberOfElements;

  bool first;

  bool last;

  List<SessionLog> content;

  SessionLogPage({
    this.number = 0,
    this.size = 0,
    this.totalElements = 0,
    this.totalPages = 0,
    this.numberOfElements = 0,
    this.first = true,
    this.last = true,
    List<SessionLog>? content,
  }) : content = content ?? <SessionLog>[];

  factory SessionLogPage.fromJson(Map<String, dynamic> json) {
    return SessionLogPage(
      number: json['number'] ?? 0,
      size: json['size'] ?? 0,
      totalElements: json['totalElements'] ?? 0,
      totalPages: json['totalPages'] ?? 0,
      numberOfElements: json['numberOfElements'] ?? 0,
      first: json['first'] ?? true,
      last: json['last'] ?? true,
      content: json['content'] == null
          ? <SessionLog>[]
          : (json['content'] as List)
              .map((item) => SessionLog.fromJson(item))
              .toList(),
    );
  }
}
