// To parse this JSON data, do
//
//     final country = countryFromJson(jsonString);

import 'dart:convert';

Country countryFromJson(String str) => Country.fromJson(json.decode(str));

String countryToJson(Country data) => json.encode(data.toJson());

class Country {
  Country({
    this.totalItemsCount,
    this.data,
    this.messageStatus,
    this.message,
  });

  int? totalItemsCount;
  List<CountryData>? data;
  int? messageStatus;
  String? message;

  factory Country.fromJson(Map<String, dynamic> json) => Country(
        totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
        data: json["data"] == null ? null : List<CountryData>.from(json["data"].map((x) => CountryData.fromJson(x))),
        messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
        message: json["message"] == null ? null : json["message"],
      );

  Map<String, dynamic> toJson() => {
        "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
        "data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
        "messageStatus": messageStatus == null ? null : messageStatus,
        "message": message == null ? null : message,
      };
}

class CountryData {
  CountryData({
    this.id,
    this.countryName,
    this.countryNameN,
    this.nationality,
    this.nationalityN,
    this.countryCode,
    this.alpha2Code,
    this.alpha3Code,
  });

  int? id;
  String? countryName;
  String? countryNameN;
  String? nationality;
  String? nationalityN;
  String? countryCode;
  String? alpha2Code;
  String? alpha3Code;

  factory CountryData.fromJson(Map<String, dynamic> json) => CountryData(
        id: json["id"] == null ? null : json["id"],
        countryName: json["countryName"] == null ? null : json["countryName"],
        countryNameN: json["countryNameN"] == null ? null : json["countryNameN"],
        nationality: json["nationality"] == null ? null : json["nationality"],
        nationalityN: json["nationalityN"] == null ? null : json["nationalityN"],
        countryCode: json["countryCode"] == null ? null : json["countryCode"],
        alpha2Code: json["alpha2Code"] == null ? null : json["alpha2Code"],
        alpha3Code: json["alpha3Code"] == null ? null : json["alpha3Code"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "countryName": countryName == null ? null : countryName,
        "countryNameN": countryNameN == null ? null : countryNameN,
        "nationality": nationality == null ? null : nationality,
        "nationalityN": nationalityN == null ? null : nationalityN,
        "countryCode": countryCode == null ? null : countryCode,
        "alpha2Code": alpha2Code == null ? null : alpha2Code,
        "alpha3Code": alpha3Code == null ? null : alpha3Code,
      };
}
