import '../../../../core/models/name.dart';

class OrdersListResponse {
  OrdersListResponse({this.totalCount, this.data});

  OrdersListResponse.fromJson(dynamic json) {
    totalCount = json['totalCount'];
    if (json['data'] != null) {
      data = [];
      json['data'].forEach((v) {
        data?.add(Data.fromJson(v));
      });
    }
  }

  int? totalCount;
  List<Data>? data;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['totalCount'] = totalCount;
    if (data != null) {
      map['data'] = data?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

class Data {
  Data({
    this.id,
    this.userUcode,
    this.phoneNumber,
    this.gmail,
    this.quantity,
    this.nameUz,
    this.nameRu,
    this.nameZh,
    this.size,
    this.wharehouseUz,
    this.wharehouseRu,
    this.wharehouseZh,
    this.deliveryPrice,
    this.shipmentId,
    this.leadId,
    this.status,
    this.partiallyArrived,
    this.fullArrived,
    this.orderNumber,
    this.createdAt,
    this.updatedAt,
    this.v,
    this.arrivalDate,
  });

  Data.fromJson(dynamic json) {
    userUcode = json['user_ucode'];
    phoneNumber = json['phone_number'];
    gmail = json['gmail'];
    quantity = json['quantity'];
    nameUz = json['nameUz'];
    nameRu = json['nameRu'];
    nameZh = json['nameZh'];
    size = json['size'];
    wharehouseUz = json['wharehouseUz'];
    wharehouseRu = json['wharehouseRu'];
    wharehouseZh = json['wharehouseZh'];
    deliveryPrice = json['delivery_price'];
    shipmentId = json['shipment_id'];
    leadId = json['lead_id'];
    status = json['status'] != null ? Status.fromJson(json['status']) : null;
    partiallyArrived = json['partially_arrived'];
    fullArrived = json['full_arrived'];
    orderNumber = json['order_number'];
    createdAt = json['createdAt'];
    updatedAt = json['updatedAt'];
    v = json['__v'];
    id = json['id'];
    arrivalDate = json['arrival_date'];
  }

  String? userUcode;
  String? phoneNumber;
  String? gmail;
  int? quantity;
  String? nameUz;
  String? nameRu;
  String? nameZh;
  String? size;
  String? wharehouseUz;
  String? wharehouseRu;
  String? wharehouseZh;
  String? deliveryPrice;
  String? shipmentId;
  String? leadId;
  Status? status;
  bool? partiallyArrived;
  bool? fullArrived;
  String? orderNumber;
  String? createdAt;
  String? updatedAt;
  int? v;
  String? id;
  String? arrivalDate;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['_id'] = id;
    map['user_ucode'] = userUcode;
    map['phone_number'] = phoneNumber;
    map['gmail'] = gmail;
    map['quantity'] = quantity;
    map['nameUz'] = nameUz;
    map['nameRu'] = nameRu;
    map['nameZh'] = nameZh;
    map['size'] = size;
    map['wharehouseUz'] = wharehouseUz;
    map['wharehouseRu'] = wharehouseRu;
    map['wharehouseZh'] = wharehouseZh;
    map['delivery_price'] = deliveryPrice;
    map['shipment_id'] = shipmentId;
    map['lead_id'] = leadId;
    if (status != null) {
      map['status'] = status?.toJson();
    }
    map['partially_arrived'] = partiallyArrived;
    map['full_arrived'] = fullArrived;
    map['order_number'] = orderNumber;
    map['createdAt'] = createdAt;
    map['updatedAt'] = updatedAt;
    map['__v'] = v;
    map['id'] = id;
    map['arrival_date'] = arrivalDate;
    return map;
  }
}

class Status {
  Status({this.code, this.translations});

  Status.fromJson(dynamic json) {
    code = json['code'];
    translations =
        json['translations'] != null
            ? Name.fromJson(json['translations'])
            : null;
  }

  String? code;
  Name? translations;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['code'] = code;
    if (translations != null) {
      map['translations'] = translations?.toJson();
    }
    return map;
  }
}
