import 'dart:convert';

class AiLabOrdersOverView {
  String? orderDate;
  String? clinic;
  String? doctor;
  List<Result>? results;

  AiLabOrdersOverView({
    this.orderDate,
    this.clinic,
    this.doctor,
    this.results,
  });

  factory AiLabOrdersOverView.fromRawJson(String str) => AiLabOrdersOverView.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory AiLabOrdersOverView.fromJson(Map<String, dynamic> json) => AiLabOrdersOverView(
    orderDate: json["order_date"] == null ? null : json["order_date"],
    clinic: json["clinic"],
    doctor: json["doctor"],
    results: json["results"] == null ? [] : List<Result>.from(json["results"]!.map((x) => Result.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "order_date": orderDate,
    "clinic": clinic,
    "doctor": doctor,
    "results": results == null ? [] : List<dynamic>.from(results!.map((x) => x.toJson())),
  };
}

class Result {
  String? testName;
  String? resultValue;
  String? referenceRange;
  String? unit;
  String? flag;

  Result({
    this.testName,
    this.resultValue,
    this.referenceRange,
    this.unit,
    this.flag,
  });

  factory Result.fromRawJson(String str) => Result.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Result.fromJson(Map<String, dynamic> json) => Result(
    testName: json["test_name"],
    resultValue: json["result_value"],
    referenceRange: json["reference_range"],
    unit: json["unit"],
    flag: json["flag"],
  );

  Map<String, dynamic> toJson() => {
    "test_name": testName,
    "result_value": resultValue,
    "reference_range": referenceRange,
    "unit": unit,
    "flag": flag,
  };
}
