PIbd31_Razubaev.S.M._PMU/lib/data/dtos/mangas_dto.dart
2024-10-17 16:31:39 +04:00

64 lines
1.8 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'mangas_dto.g.dart';
@JsonSerializable(createToJson: false)
class MangasDto {
final List<MangaDataDto>? data;
final MangaPaginationDto? pagination;
const MangasDto({this.data, this.pagination});
factory MangasDto.fromJson(Map<String, dynamic> json) =>
_$MangasDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class MangaPaginationDto {
@JsonKey(name: 'current_page')
final int? currentPage;
@JsonKey(name: 'has_next_page')
final bool? hasNextPage;
@JsonKey(name: 'last_visible_page')
final int? lastVisiblePage;
const MangaPaginationDto({this.currentPage, this.hasNextPage, this.lastVisiblePage});
factory MangaPaginationDto.fromJson(Map<String, dynamic> json) =>
_$MangaPaginationDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class MangaDataDto {
@JsonKey(name: "mal_id")
final int? id;
final String? type;
final String? title;
final String? status;
final double? score;
final int? scored_by;
final MangaDataImagesDto? images;
const MangaDataDto(this.title, this.status, this.score, this.scored_by, this.images, {this.id, this.type});
factory MangaDataDto.fromJson(Map<String, dynamic> json) =>
_$MangaDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class MangaDataImagesDto {
final MangaDataImagesJPGDto? jpg;
const MangaDataImagesDto({this.jpg});
factory MangaDataImagesDto.fromJson(Map<String, dynamic> json) =>
_$MangaDataImagesDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class MangaDataImagesJPGDto {
final String? image_url;
const MangaDataImagesJPGDto({this.image_url});
factory MangaDataImagesJPGDto.fromJson(Map<String, dynamic> json) =>
_$MangaDataImagesJPGDtoFromJson(json);
}