import 'SuppliesUsing.dart';

class Dung {
  int? id;
  int? activityId;
  int? cropId;
  String? executeDate;
  String? description;
  String? media;
  num? quarantinePeriod;
  String? weatherConditions;
  String? purpose;
  String? executeBy;
  List<String>? mediaDel;
  List<SuppliesUsing>? suppliesUsing;

  Dung(
      {this.id,
      this.activityId,
      this.cropId,
      this.executeDate,
      this.description,
      this.media,
      this.quarantinePeriod,
      this.weatherConditions,
      this.purpose,
      this.executeBy,
      this.mediaDel,
      this.suppliesUsing});

  Dung.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    cropId = json['cropId'];
    activityId = json['activityId'];
    executeDate = json['executeDate'];
    description = json['description'];
    media = json['media'];
    quarantinePeriod = json['quarantinePeriod'];
    weatherConditions = json['weatherConditions'];
    purpose = json['purpose'];
    executeBy = json['executeBy'];
    if (json['suppliesUsing'] != null) {
      suppliesUsing = <SuppliesUsing>[];
      json['suppliesUsing'].forEach((v) {
        suppliesUsing?.add(SuppliesUsing.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['cropId'] = cropId;
    data['activityId'] = activityId;
    data['executeDate'] = executeDate;
    data['description'] = description;
    data['media'] = media;
    data['quarantinePeriod'] = quarantinePeriod;
    data['weatherConditions'] = weatherConditions;
    data['purpose'] = purpose;
    data['executeBy'] = executeBy;
    data['media_del'] = mediaDel;
    if (suppliesUsing != null) {
      data['suppliesUsing'] = suppliesUsing?.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
