

import 'dart:convert';

AddressResponse addressResponseFromJson(dynamic str) =>
    AddressResponse.fromJson(json.decode(str));

dynamic addressResponseToJson(AddressResponse data) =>
    json.encode(data.toJson());

class AddressResponse {
  List<Datum>? data;
  Meta? meta;

  AddressResponse({
    this.data,
    this.meta,
  });

  factory AddressResponse.fromJson(Map<dynamic, dynamic> json) =>
      AddressResponse(
        data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
        meta: Meta.fromJson(json["meta"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "data": List<dynamic>.from(data!.map((x) => x.toJson())),
        "meta": meta!.toJson(),
      };
}

class Datum {
  dynamic id;
  dynamic pincode;
  dynamic phoneNumber;
  dynamic alternatePhoneNumber;
  dynamic addressLine;
  dynamic landmark;
  dynamic addressType;
  dynamic city;
  dynamic district;
  dynamic name;
  dynamic state;
  dynamic country;
  bool? isDeliverable;
  bool? isDefault;
  dynamic additionalInstructions;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic userId;
  User? user;

  Datum({
    this.id,
    this.pincode,
    this.phoneNumber,
    this.alternatePhoneNumber,
    this.addressLine,
    this.landmark,
    this.addressType,
    this.city,
    this.district,
    this.name,
    this.state,
    this.country,
    this.isDeliverable,
    this.isDefault,
    this.additionalInstructions,
    this.createdAt,
    this.updatedAt,
    this.userId,
    this.user,
  });

  factory Datum.fromJson(Map<dynamic, dynamic> json) => Datum(
        id: json["id"],
        pincode: json["pincode"],
        phoneNumber: json["phoneNumber"],
        alternatePhoneNumber: json["alternatePhoneNumber"],
        addressLine: json["addressLine"],
        landmark: json["landmark"],
        addressType: json["addressType"],
        city: json["city"],
        district: json["district"],
        name: json["name"],
        state: json["state"],
        country: json["country"],
        isDeliverable: json["isDeliverable"],
        isDefault: json["isDefault"],
        additionalInstructions: json["additionalInstructions"],
        createdAt: DateTime.parse(json["createdAt"]),
        updatedAt: DateTime.parse(json["updatedAt"]),
        userId: json["userId"],
        user: User.fromJson(json["user"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "pincode": pincode,
        "phoneNumber": phoneNumber,
        "alternatePhoneNumber": alternatePhoneNumber,
        "addressLine": addressLine,
        "landmark": landmark,
        "addressType": addressType,
        "city": city,
        "district": district,
        "name": name,
        "state": state,
        "country": country,
        "isDeliverable": isDeliverable,
        "isDefault": isDefault,
        "additionalInstructions": additionalInstructions,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "userId": userId,
        "user": user!.toJson(),
      };
}

class User {
  dynamic firstName;
  dynamic lastName;
  dynamic email;
  dynamic phone;

  User({
    this.firstName,
    this.lastName,
    this.email,
    this.phone,
  });

  factory User.fromJson(Map<dynamic, dynamic> json) => User(
        firstName: json["firstName"],
        lastName: json["lastName"],
        email: json["email"],
        phone: json["phone"],
      );

  Map<dynamic, dynamic> toJson() => {
        "firstName": firstName,
        "lastName": lastName,
        "email": email,
        "phone": phone,
      };
}

class Meta {
  int? total;
  int? page;
  int? limit;
  int? lastPage;
  bool? hasNextPage;
  bool? hasPreviousPage;

  Meta({
    this.total,
    this.page,
    this.limit,
    this.lastPage,
    this.hasNextPage,
    this.hasPreviousPage,
  });

  factory Meta.fromJson(Map<dynamic, dynamic> json) => Meta(
        total: json["total"],
        page: json["page"],
        limit: json["limit"],
        lastPage: json["lastPage"],
        hasNextPage: json["hasNextPage"],
        hasPreviousPage: json["hasPreviousPage"],
      );

  Map<dynamic, dynamic> toJson() => {
        "total": total,
        "page": page,
        "limit": limit,
        "lastPage": lastPage,
        "hasNextPage": hasNextPage,
        "hasPreviousPage": hasPreviousPage,
      };
}
