import 'TbCropDTO.dart';

class CropPlot {
  TbCropDTO? tbCropDTO;
  List<Activities>? activities;
  String? sowingDate;
  int? soakSeedsTime;
  num? seedIncubationTime;
  int? numberPlants;
  int? numberCurrentPlants;
  String? endOfFarmingDate;

  CropPlot(
      {this.tbCropDTO,
      this.activities,
      this.sowingDate,
      this.soakSeedsTime,
      this.seedIncubationTime,
      this.numberPlants,
      this.numberCurrentPlants,
      this.endOfFarmingDate});

  CropPlot.fromJson(Map<String, dynamic> json) {
    tbCropDTO = json['tbCropDTO'] != null ? new TbCropDTO.fromJson(json['tbCropDTO']) : null;
    if (json['activities'] != null) {
      activities = <Activities>[];
      json['activities'].forEach((v) {
        activities?.add(new Activities.fromJson(v));
      });
    }
    sowingDate = json['sowingDate'];
    soakSeedsTime = json['soakSeedsTime'];
    seedIncubationTime = json['seedIncubationTime'];
    numberPlants = json['numberPlants'];
    numberCurrentPlants = json['numberCurrentPlants'];
    endOfFarmingDate = json['endOfFarmingDate'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.tbCropDTO != null) {
      data['tbCropDTO'] = this.tbCropDTO?.toJson();
    }
    if (this.activities != null) {
      data['activities'] = this.activities?.map((v) => v.toJson()).toList();
    }
    data['sowingDate'] = this.sowingDate;
    data['soakSeedsTime'] = this.soakSeedsTime;
    data['seedIncubationTime'] = this.seedIncubationTime;
    data['numberPlants'] = this.numberPlants;
    data['numberCurrentPlants'] = this.numberCurrentPlants;
    data['endOfFarmingDate'] = this.endOfFarmingDate;
    return data;
  }
}

class TbDetailUsers {
  int? id;
  String? fullName;
  String? phone;

  TbDetailUsers({this.id, this.fullName, this.phone});

  TbDetailUsers.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    fullName = json['fullName'];
    phone = json['phone'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['fullName'] = this.fullName;
    data['phone'] = this.phone;
    return data;
  }
}

class Activities {
  int? id;
  int? ageDay;
  int? cropId;
  String? executeDate;
  String? description;
  int? activityTypeId;
  String? activityTypeName;
  String? activityTypeDescription;

  Activities(
      {this.id,
      this.ageDay,
      this.cropId,
      this.executeDate,
      this.description,
      this.activityTypeId,
      this.activityTypeName,
      this.activityTypeDescription});

  Activities.clone(Activities activities) {
    this.id = activities.id;
    this.cropId = activities.cropId;
    this.activityTypeName = activities.activityTypeName;
    this.activityTypeDescription = activities.activityTypeDescription;
    this.executeDate = activities.executeDate;
  }

  Activities.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    ageDay = json['ageDay'];
    cropId = json['cropId'];
    executeDate = json['executeDate'];
    description = json['description'];
    activityTypeId = json['activityTypeId'];
    activityTypeName = json['activityTypeName'];
    activityTypeDescription = json['activityTypeDescription'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['ageDay'] = this.ageDay;
    data['cropId'] = this.cropId;
    data['executeDate'] = this.executeDate;
    data['description'] = this.description;
    data['activityTypeId'] = this.activityTypeId;
    data['activityTypeName'] = this.activityTypeName;
    data['activityTypeDescription'] = this.activityTypeDescription;
    return data;
  }
}
