import 'package:json_annotation/json_annotation.dart';

part 'spells_dto.g.dart';

@JsonSerializable(createToJson: false)
class SpellsDto {
  final List<SpellDataDto>? data;
  final MetaDto? meta;

  const SpellsDto({
    this.data,
    this.meta,
  });

  factory SpellsDto.fromJson(Map<String, dynamic> json) =>
      _$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);
}

@JsonSerializable(createToJson: false)
class SpellDataDto {
  final String id;
  final String? type;
  final SpellAttributesDataDto? attributes;

  const SpellDataDto(
    this.id, {
    this.type,
    this.attributes,
  });

  factory SpellDataDto.fromJson(Map<String, dynamic> json) =>
      _$SpellDataDtoFromJson(json);
}

@JsonSerializable(createToJson: false)
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);
}
