import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/Category.dart';

class CreatePhysicalExamination {
  bool? isChecked; // it will be told
  bool? selected; // same as above
  String? pomrid; // paitient
  int? patientID; // paitint
  bool? isClinicPhysicalExamination; // it will be told
  dynamic? physicalExaminationSystemID; // category id
  String? physicalExaminationDescription; // name of the category
  int? specialityID; // id of the specialitiy id
  dynamic selectedOptions; // it will also be told but it could be sent as null
  bool? isMandatory; // it will also be checked default value is false
  String? specialityDescription; // name of the speciality
  int? physicalExaminationCondition; // condition selected
  String? loginUserId; // doctor id
  String? remark;

  CreatePhysicalExamination();

  CreatePhysicalExamination.fromJson(Map<String, dynamic> json) {
    isChecked = json['isChecked'];
    selected = json['selected'];
    pomrid = json['pomrid'];
    patientID = json['patientID'];
    isClinicPhysicalExamination = json['isClinicPhysicalExamination'];
    physicalExaminationSystemID = json['physicalExaminationSystemID'];
    physicalExaminationDescription = json['physicalExaminationDescription'];
    specialityID = json['specialityID'];
    selectedOptions = json['selectedOptions'];
    isMandatory = json['isMandatory'];
    specialityDescription = json['specialityDescription'];
    physicalExaminationCondition = json['physicalExaminationCondition'];
    loginUserId = json['loginUserId'];
    remark = json['remark'];
  }

  Map<String, dynamic> toJson() {
    return {
      'isChecked': isChecked,
      'selected': selected,
      'pomrid': pomrid,
      'patientID': patientID,
      'isClinicPhysicalExamination': isClinicPhysicalExamination,
      'physicalExaminationSystemID': physicalExaminationSystemID,
      'physicalExaminationDescription': physicalExaminationDescription,
      'specialityID': specialityID,
      'selectedOptions': selectedOptions,
      'isMandatory': isMandatory,
      'specialityDescription': specialityDescription,
      'physicalExaminationCondition': physicalExaminationCondition,
      'loginUserId': loginUserId,
      'remark': remark,
    };
  }
}

extension ConvertCategoryToCreatePhysicalExamination on Category {
  CreatePhysicalExamination createPhysicalExaminationFromCategory() =>
      CreatePhysicalExamination()
        ..isChecked = true
        ..physicalExaminationDescription = this.name
        ..physicalExaminationSystemID = this.id
        ..physicalExaminationCondition = this.selectedCondition
        ..remark = this.remarksController.text
        ..selected = false
        ..specialityID = this.specialityId
        ..patientID = this.paitientId
        ..pomrid = this.pomrId
        ..loginUserId = this.userID?.toString()
        ..isMandatory = false
        ..specialityDescription = this.specialityName
        ..isClinicPhysicalExamination = true;
}
