import 'dart:convert';

class LabOrderResponseByAi {
  String? summary;
  List<AiGeneratedAttribute>? aiGeneratedAttributes;
  List<String>? aiPredictions;
  List<AiRecommendation>? aiRecommendations;
  List<RiskFactor>? riskFactors;
  List<String>? prevention;
  List<dynamic>? suggestedDoctors;
  String? rawMessage;

  LabOrderResponseByAi({
    this.summary,
    this.aiGeneratedAttributes,
    this.aiPredictions,
    this.aiRecommendations,
    this.riskFactors,
    this.prevention,
    this.suggestedDoctors,
    this.rawMessage,
  });

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

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

  factory LabOrderResponseByAi.fromJson(Map<String, dynamic> json) => LabOrderResponseByAi(
        summary: json["summary"],
        aiGeneratedAttributes: json["ai_generated_attributes"] == null ? [] : List<AiGeneratedAttribute>.from(json["ai_generated_attributes"]!.map((x) => AiGeneratedAttribute.fromJson(x))),
        aiPredictions: json["ai_predictions"] == null ? [] : List<String>.from(json["ai_predictions"]!.map((x) => x)),
        aiRecommendations: json["ai_recommendations"] == null ? [] : List<AiRecommendation>.from(json["ai_recommendations"]!.map((x) => AiRecommendation.fromJson(x))),
        riskFactors: json["riskFactors"] == null ? [] : List<RiskFactor>.from(json["riskFactors"]!.map((x) => RiskFactor.fromJson(x))),
        prevention: json["prevention"] == null ? [] : List<String>.from(json["prevention"]!.map((x) => x)),
        suggestedDoctors: json["suggested_doctors"] == null ? [] : List<dynamic>.from(json["suggested_doctors"]!.map((x) => x)),
        rawMessage: json["raw_message"],
      );

  Map<String, dynamic> toJson() => {
        "summary": summary,
        "ai_generated_attributes": aiGeneratedAttributes == null ? [] : List<dynamic>.from(aiGeneratedAttributes!.map((x) => x.toJson())),
        "ai_predictions": aiPredictions == null ? [] : List<dynamic>.from(aiPredictions!.map((x) => x)),
        "ai_recommendations": aiRecommendations == null ? [] : List<dynamic>.from(aiRecommendations!.map((x) => x.toJson())),
        "riskFactors": riskFactors == null ? [] : List<dynamic>.from(riskFactors!.map((x) => x.toJson())),
        "prevention": prevention == null ? [] : List<dynamic>.from(prevention!.map((x) => x)),
        "suggested_doctors": suggestedDoctors == null ? [] : List<dynamic>.from(suggestedDoctors!.map((x) => x)),
        "raw_message": rawMessage,
      };
}

class AiGeneratedAttribute {
  String? description;
  String? resultValue;
  String? referanceRange;
  String? calculatedResultFlag;
  String? uom;
  String? calculationFormula;
  String? testShortDescription;

  AiGeneratedAttribute({
    this.description,
    this.resultValue,
    this.referanceRange,
    this.calculatedResultFlag,
    this.uom,
    this.calculationFormula,
    this.testShortDescription,
  });

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

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

  factory AiGeneratedAttribute.fromJson(Map<String, dynamic> json) => AiGeneratedAttribute(
        description: json["Description"],
        resultValue: json["ResultValue"],
        referanceRange: json["ReferanceRange"],
        calculatedResultFlag: json["CalculatedResultFlag"],
        uom: json["UOM"],
        calculationFormula: json["calculationFormula"],
        testShortDescription: json["TestShortDescription"],
      );

  Map<String, dynamic> toJson() => {
        "Description": description,
        "ResultValue": resultValue,
        "ReferanceRange": referanceRange,
        "CalculatedResultFlag": calculatedResultFlag,
        "UOM": uom,
        "calculationFormula": calculationFormula,
        "TestShortDescription": testShortDescription,
      };
}

class AiRecommendation {
  String? recommendation;
  String? priority;

  AiRecommendation({
    this.recommendation,
    this.priority,
  });

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

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

  factory AiRecommendation.fromJson(Map<String, dynamic> json) => AiRecommendation(
        recommendation: json["recommendation"],
        priority: json["priority"],
      );

  Map<String, dynamic> toJson() => {
        "recommendation": recommendation,
        "priority": priority,
      };
}

class RiskFactor {
  String? factor;
  String? risk;
  String? description;

  RiskFactor({
    this.factor,
    this.risk,
    this.description,
  });

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

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

  factory RiskFactor.fromJson(Map<String, dynamic> json) => RiskFactor(
        factor: json["factor"],
        risk: json["risk"],
        description: json["description"],
      );

  Map<String, dynamic> toJson() => {
        "factor": factor,
        "risk": risk,
        "description": description,
      };
}
