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(NurseryDetail.fromJson(v));
      });
    }
  }

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