import 'SuppliesUsing.dart';

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

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

  Spraying.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    activityId = json['activityId'];
    cropId = json['cropId'];
    media = json['media'];
    executeDate = json['executeDate'];
    quarantinePeriod = json['quarantinePeriod'];
    resultAt = json['resultAt'];
    weatherConditions = json['weatherConditions'];
    purpose = json['purpose'];
    description = json['description'];
    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['activityId'] = activityId;
    data['cropId'] = cropId;
    data['media'] = media;
    data['media_del'] = mediaDel;
    data['executeDate'] = executeDate;
    data['quarantinePeriod'] = quarantinePeriod;
    data['resultAt'] = resultAt;
    data['weatherConditions'] = weatherConditions;
    data['purpose'] = purpose;
    data['description'] = description;
    data['executeBy'] = executeBy;
    if (suppliesUsing != null) {
      data['suppliesUsing'] = suppliesUsing?.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
