import 'NurseryDetail.dart';

class Nursery {
  int? id;
  int? activityId;
  int? cropId;
  String? executeDate;
  String? description;
  String? executeBy;
  String? media;
  List<String>? mediaDel;
  String? seedName;
  num? substratesId;
  String? substrateName;
  num? seedLength;
  num? quantity;
  num? seedIncubationTime;
  List<NurseryDetail>? nurseryDetail;

  Nursery(
      {this.id,
      this.activityId,
      this.cropId,
      this.executeDate,
      this.description,
      this.executeBy,
      this.media,
      this.mediaDel,
      this.seedName,
      this.substratesId,
      this.substrateName,
      this.seedLength,
      this.quantity,
      this.seedIncubationTime,
      this.nurseryDetail});

  Nursery.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    activityId = json['activityId'];
    cropId = json['cropId'];
    executeDate = json['executeDate'];
    description = json['description'];
    executeBy = json['executeBy'];
    media = json['media'];
    seedName = json['seedName'];
    substratesId = json['substratesId'];
    substrateName = json['substrateName'];
    seedLength = json['seedLength'];
    quantity = json['quantity'];
    seedIncubationTime = json['seedIncubationTime'];
    if (json['nurseryDetail'] != null) {
      nurseryDetail = <NurseryDetail>[];
      json['nurseryDetail'].forEach((v) {
        nurseryDetail?.add(new NurseryDetail.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['activityId'] = this.activityId;
    data['cropId'] = this.cropId;
    data['executeDate'] = this.executeDate;
    data['description'] = this.description;
    data['executeBy'] = this.executeBy;
    data['media'] = this.media;
    data['media_del'] = this.mediaDel;
    data['seedName'] = this.seedName;
    data['substratesId'] = this.substratesId;
    data['substrateName'] = this.substrateName;
    data['seedLength'] = this.seedLength;
    data['quantity'] = this.quantity;
    data['seedIncubationTime'] = this.seedIncubationTime;
    if (this.nurseryDetail != null) {
      data['nurseryDetail'] = this.nurseryDetail?.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
