class CropPlot {
  TbCropDTO? tbCropDTO;
  List<Activities>? activities;
  String? sowingDate;
  int? soakSeedsTime;
  int? seedIncubationTime;
  int? numberPlants;
  int? numberCurrentPlants;
  String? endOfFarmingDate;

  CropPlot(
      {this.tbCropDTO,
      this.activities,
      this.sowingDate,
      this.soakSeedsTime,
      this.seedIncubationTime,
      this.numberPlants,
      this.numberCurrentPlants,
      this.endOfFarmingDate});

  CropPlot.fromJson(Map<String, dynamic> json) {
    tbCropDTO = json['tbCropDTO'] != null ? TbCropDTO.fromJson(json['tbCropDTO']) : null;
    if (json['activities'] != null) {
      activities = <Activities>[];
      json['activities'].forEach((v) {
        activities?.add(Activities.fromJson(v));
      });
    }
    sowingDate = json['sowingDate'];
    soakSeedsTime = json['soakSeedsTime'];
    seedIncubationTime = json['seedIncubationTime'];
    numberPlants = json['numberPlants'];
    numberCurrentPlants = json['numberCurrentPlants'];
    endOfFarmingDate = json['endOfFarmingDate'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    if (tbCropDTO != null) {
      data['tbCropDTO'] = tbCropDTO?.toJson();
    }
    if (activities != null) {
      data['activities'] = activities?.map((v) => v.toJson()).toList();
    }
    data['sowingDate'] = sowingDate;
    data['soakSeedsTime'] = soakSeedsTime;
    data['seedIncubationTime'] = seedIncubationTime;
    data['numberPlants'] = numberPlants;
    data['numberCurrentPlants'] = numberCurrentPlants;
    data['endOfFarmingDate'] = endOfFarmingDate;
    return data;
  }
}

class TbCropDTO {
  int? id;
  String? qrCode;
  String? code;
  num? areaM2;
  int? type;
  String? startDate;
  String? endDate;
  String? status;
  String? description;
  int? ageDayStartAt;
  int? tbSuppliesId;
  String? suppliesName;
  int? tbGuidelineId;
  int? netHouseId;
  String? netHouseName;
  int? areaId;
  String? area;
  List<TbDetailUsers>? tbDetailUsers;

  TbCropDTO(
      {this.id,
      this.qrCode,
      this.code,
      this.areaM2,
      this.type,
      this.startDate,
      this.endDate,
      this.status,
      this.description,
      this.ageDayStartAt,
      this.tbSuppliesId,
      this.suppliesName,
      this.tbGuidelineId,
      this.netHouseId,
      this.netHouseName,
      this.areaId,
      this.area,
      this.tbDetailUsers});

  TbCropDTO.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    qrCode = json['qrCode'];
    code = json['code'];
    areaM2 = json['areaM2'];
    type = json['type'];
    startDate = json['startDate'];
    endDate = json['endDate'];
    status = json['status'];
    description = json['description'];
    ageDayStartAt = json['ageDayStartAt'];
    tbSuppliesId = json['tbSuppliesId'];
    suppliesName = json['suppliesName'];
    tbGuidelineId = json['tbGuidelineId'];
    netHouseId = json['netHouseId'];
    netHouseName = json['netHouseName'];
    areaId = json['areaId'];
    area = json['area'];
    if (json['tbDetailUsers'] != null) {
      tbDetailUsers = <TbDetailUsers>[];
      json['tbDetailUsers'].forEach((v) {
        tbDetailUsers?.add(TbDetailUsers.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['qrCode'] = qrCode;
    data['code'] = code;
    data['areaM2'] = areaM2;
    data['type'] = type;
    data['startDate'] = startDate;
    data['endDate'] = endDate;
    data['status'] = status;
    data['description'] = description;
    data['ageDayStartAt'] = ageDayStartAt;
    data['tbSuppliesId'] = tbSuppliesId;
    data['suppliesName'] = suppliesName;
    data['tbGuidelineId'] = tbGuidelineId;
    data['netHouseId'] = netHouseId;
    data['netHouseName'] = netHouseName;
    data['areaId'] = areaId;
    data['area'] = area;
    if (tbDetailUsers != null) {
      data['tbDetailUsers'] = tbDetailUsers?.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class TbDetailUsers {
  int? id;
  String? fullName;
  String? phone;

  TbDetailUsers({this.id, this.fullName, this.phone});

  TbDetailUsers.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    fullName = json['fullName'];
    phone = json['phone'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['fullName'] = fullName;
    data['phone'] = phone;
    return data;
  }
}

class Activities {
  int? id;
  int? ageDay;
  int? cropId;
  String? executeDate;
  String? description;
  int? activityTypeId;
  String? activityTypeName;
  String? activityTypeDescription;

  Activities(
      {this.id,
      this.ageDay,
      this.cropId,
      this.executeDate,
      this.description,
      this.activityTypeId,
      this.activityTypeName,
      this.activityTypeDescription});

  Activities.clone(Activities activities) {
    id = activities.id;
    cropId = activities.cropId;
    activityTypeName = activities.activityTypeName;
    activityTypeDescription = activities.activityTypeDescription;
    executeDate = activities.executeDate;
  }

  Activities.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    ageDay = json['ageDay'];
    cropId = json['cropId'];
    executeDate = json['executeDate'];
    description = json['description'];
    activityTypeId = json['activityTypeId'];
    activityTypeName = json['activityTypeName'];
    activityTypeDescription = json['activityTypeDescription'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['ageDay'] = ageDay;
    data['cropId'] = cropId;
    data['executeDate'] = executeDate;
    data['description'] = description;
    data['activityTypeId'] = activityTypeId;
    data['activityTypeName'] = activityTypeName;
    data['activityTypeDescription'] = activityTypeDescription;
    return data;
  }
}
