import 'CropPlot.dart';

class TbCropDTO {
  int? id;
  String? qrCode;
  String? code;
  num? areaM2;
  int? tbCropTypeId;
  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.tbCropTypeId,
    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'];
    tbCropTypeId = json['tbCropTypeId'];
    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(new TbDetailUsers.fromJson(v));
      });
    }
  }

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