87 lines
2.0 KiB
Dart
Raw Normal View History

2024-10-01 15:01:01 +04:00
import 'package:json_annotation/json_annotation.dart';
part 'spells_dto.g.dart';
@JsonSerializable(createToJson: false)
2024-10-01 22:57:57 +04:00
class SpellsDto {
2024-10-01 15:01:01 +04:00
final List<SpellDataDto>? data;
2024-10-27 21:53:28 +04:00
final MetaDto? meta;
2024-10-01 15:01:01 +04:00
2024-10-01 22:57:57 +04:00
const SpellsDto({
2024-10-01 18:21:37 +04:00
this.data,
2024-10-27 21:53:28 +04:00
this.meta,
2024-10-01 18:21:37 +04:00
});
2024-10-01 15:01:01 +04:00
2024-10-01 22:57:57 +04:00
factory SpellsDto.fromJson(Map<String, dynamic> json) =>
2024-10-27 21:53:28 +04:00
_$SpellsDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class MetaDto {
final PaginationDto? pagination;
const MetaDto({this.pagination});
factory MetaDto.fromJson(Map<String, dynamic> json) =>
_$MetaDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class PaginationDto {
final int? current;
final int? next;
final int? last;
final int? records;
const PaginationDto({this.current, this.next, this.last, this.records});
factory PaginationDto.fromJson(Map<String, dynamic> json) =>
_$PaginationDtoFromJson(json);
2024-10-01 15:01:01 +04:00
}
@JsonSerializable(createToJson: false)
2024-10-01 18:21:37 +04:00
class SpellDataDto {
2024-10-27 21:53:28 +04:00
final String id;
2024-10-01 18:21:37 +04:00
final String? type;
final SpellAttributesDataDto? attributes;
2024-10-01 15:01:01 +04:00
2024-10-27 21:53:28 +04:00
const SpellDataDto(
this.id, {
2024-10-01 18:21:37 +04:00
this.type,
this.attributes,
});
2024-10-01 15:01:01 +04:00
2024-10-01 18:21:37 +04:00
factory SpellDataDto.fromJson(Map<String, dynamic> json) =>
_$SpellDataDtoFromJson(json);
2024-10-01 15:01:01 +04:00
}
@JsonSerializable(createToJson: false)
2024-10-01 18:21:37 +04:00
class SpellAttributesDataDto {
final String? slug; // хз
final String? category; // категория
final String? creator; // создатель
final String? effect; // воздействие
final String? hand; // взмах
final String? image; // картинка
final String? incantation; // произношение
final String? light; // цвет
final String? name; // название
final String? wiki; // ссылка на вики
const SpellAttributesDataDto({
this.slug,
this.category,
this.creator,
this.effect,
this.hand,
this.image,
this.incantation,
this.light,
this.name,
this.wiki,
});
factory SpellAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$SpellAttributesDataDtoFromJson(json);
}