import 'package:cargocalculaterapp/core/models/name.dart';

class OrderSingleResponse {
  OrderSingleResponse({
    this.id,
    this.userUcode,
    this.phoneNumber,
    this.gmail,
    this.quantity,
    this.nameUz,
    this.nameRu,
    this.nameZh,
    this.weight,
    this.m3,
    this.averageWeightKg,
    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,
    this.images,
  });

  OrderSingleResponse.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'];
    weight = json['weight'];
    m3 = json['m3'];
    averageWeightKg = json['average_weight_kg'];
    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'];
    images = json['images'] != null ? json['images'].cast<String>() : [];
  }

  String? userUcode;
  String? phoneNumber;
  String? gmail;
  int? quantity;
  String? nameUz;
  String? nameRu;
  String? nameZh;
  String? weight;
  String? m3;
  String? averageWeightKg;
  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;
  List<String>? images;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['user_ucode'] = userUcode;
    map['phone_number'] = phoneNumber;
    map['gmail'] = gmail;
    map['quantity'] = quantity;
    map['nameUz'] = nameUz;
    map['nameRu'] = nameRu;
    map['nameZh'] = nameZh;
    map['weight'] = weight;
    map['m3'] = m3;
    map['average_weight_kg'] = averageWeightKg;
    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;
    map['images'] = images;
    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;
  }
}
