import 'ControlsModel.dart';

class UpdateProcedureRequestModel {
  int orderNo;
  int patientMRN;
  int appointmentNo;
  int episodeID;
  int lineItemNo;
  ProcedureDetail procedureDetail;
  String vidaAuthTokenID;

  UpdateProcedureRequestModel(
      {this.orderNo,
      this.patientMRN,
      this.appointmentNo,
      this.episodeID,
      this.lineItemNo,
      this.procedureDetail,
      this.vidaAuthTokenID});

  UpdateProcedureRequestModel.fromJson(Map<String, dynamic> json) {
    orderNo = json['OrderNo'];
    patientMRN = json['PatientMRN'];
    appointmentNo = json['AppointmentNo'];
    episodeID = json['EpisodeID'];
    lineItemNo = json['LineItemNo'];
    procedureDetail = json['procedureDetail'] != null
        ? new ProcedureDetail.fromJson(json['procedureDetail'])
        : null;
    vidaAuthTokenID = json['VidaAuthTokenID'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['OrderNo'] = this.orderNo;
    data['PatientMRN'] = this.patientMRN;
    data['AppointmentNo'] = this.appointmentNo;
    data['EpisodeID'] = this.episodeID;
    data['LineItemNo'] = this.lineItemNo;
    if (this.procedureDetail != null) {
      data['procedureDetail'] = this.procedureDetail.toJson();
    }
    data['VidaAuthTokenID'] = this.vidaAuthTokenID;
    return data;
  }
}

class ProcedureDetail {
  String procedure;
  String category;
  List<Controls> controls;

  ProcedureDetail({this.procedure, this.category, this.controls});

  ProcedureDetail.fromJson(Map<String, dynamic> json) {
    procedure = json['Procedure'];
    category = json['Category'];
    if (json['Controls'] != null) {
      controls = new List<Controls>();
      json['Controls'].forEach((v) {
        controls.add(new Controls.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['Procedure'] = this.procedure;
    data['Category'] = this.category;
    if (this.controls != null) {
      data['Controls'] = this.controls.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
