Files
finger_print_app/lib/data/dto/vacations_list_response_dto.dart
Mohammed Al-Samarraie 33099c4497 1111
2026-01-18 19:52:10 +03:00

55 lines
1.4 KiB
Dart

import 'vacation_response_dto.dart';
class VacationsListResponseDto {
final int statusCode;
final bool isSuccess;
final String? message;
final VacationsListDataDto? data;
VacationsListResponseDto({
required this.statusCode,
required this.isSuccess,
this.message,
this.data,
});
factory VacationsListResponseDto.fromJson(Map<String, dynamic> json) {
return VacationsListResponseDto(
statusCode: json['statusCode'] ?? 0,
isSuccess: json['isSuccess'] ?? false,
message: json['message'],
data: json['data'] != null ? VacationsListDataDto.fromJson(json['data']) : null,
);
}
}
class VacationsListDataDto {
final List<VacationDataDto> items;
final int pageNumber;
final int pageSize;
final int totalCount;
final int totalPages;
VacationsListDataDto({
required this.items,
required this.pageNumber,
required this.pageSize,
required this.totalCount,
required this.totalPages,
});
factory VacationsListDataDto.fromJson(Map<String, dynamic> json) {
return VacationsListDataDto(
items: json['items'] != null
? (json['items'] as List)
.map((item) => VacationDataDto.fromJson(item))
.toList()
: [],
pageNumber: json['pageNumber'] ?? 1,
pageSize: json['pageSize'] ?? 15,
totalCount: json['totalCount'] ?? 0,
totalPages: json['totalPages'] ?? 1,
);
}
}