import 'package:json_annotation/json_annotation.dart';
import 'dart:convert';

part 'response_entity.g.dart';

@JsonSerializable()
class ResponseEntity {
  factory ResponseEntity.fromJson(Map<String, dynamic> json) =>
      _$ResponseEntityFromJson(json);

  ResponseEntity();

  late ResponseHeaders headers;
  late ResponseOriginal original;
  String? exception;

  Map<String, dynamic> toJson() => _$ResponseEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ResponseHeaders {
  ResponseHeaders();

  factory ResponseHeaders.fromJson(Map<String, dynamic> json) =>
      _$ResponseHeadersFromJson(json);

  Map<String, dynamic> toJson() => _$ResponseHeadersToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ResponseOriginal {
  factory ResponseOriginal.fromJson(Map<String, dynamic> json) =>
      _$ResponseOriginalFromJson(json);

  ResponseOriginal();

  int? overall;
  int? page;
  int? perpage;
  List<dynamic>? data;
  Map<String, List<String>>? errors;
  String? message;

  Map<String, dynamic> toJson() => _$ResponseOriginalToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
