{
   "$schema": "https://json-schema.org/draft/2020-12/schema",
   "type": "object",
   "title": "MyOme json report for Baseline Risk",
   "description": "MyOme report object for Baseline Risk (relative_risk only, no integrated/clinical scores)",
   "allOf": [
      {
         "$ref": "base.json"
      },
      {
         "properties": {
            "report_type": {
               "type": "string",
               "const": "BASELINE_RISK"
            },
            "results": {
               "$ref": "#/definitions/BaselineRiskReportResults"
            }
         }
      }
   ],
   "definitions": {
      "BaselineRiskReportResults": {
         "description": "Baseline Risk results with toplines, risk definitions, and next steps (no general/clinical inputs).",
         "type": "object",
         "allOf": [
            {
               "properties": {
                  "prs_type": {
                     "$ref": "../../core.json#/definitions/PRSType"
                  },
                  "toplines": {
                     "$ref": "#/definitions/BaselineRiskTopline"
                  },
                  "next_steps": {
                     "anyOf": [
                        {
                           "$ref": "../../structs.json#/definitions/ReportNextSteps"
                        },
                        {
                           "$ref": "../../structs.json#/definitions/PRSNextSteps"
                        }
                     ]
                  },
                  "sample_limitations": {
                     "type": "array",
                     "items": {
                        "type": "string"
                     }
                  },
                  "risk_definitions": {
                     "type": "object",
                     "description": "Includes polygenic_risk, relative_risk, and optionally relative_risk_data array"
                  },
                  "not_analyzed_notes": {
                     "type": "object",
                     "properties": {
                        "clinical_context": {
                           "type": "string"
                        },
                        "details": {
                           "type": "string"
                        }
                     },
                     "required": [
                        "clinical_context",
                        "details"
                     ]
                  }
               },
               "required": [
                  "prs_type",
                  "toplines",
                  "next_steps"
               ]
            },
            {
               "if": {
                  "properties": {
                     "prs_type": {
                        "enum": [
                           "NOT_ANALYZED"
                        ]
                     }
                  },
                  "required": [
                     "prs_type"
                  ]
               },
               "then": {
                  "required": [
                     "not_analyzed_notes"
                  ]
               },
               "else": {}
            }
         ]
      },
      "BaselineRiskTopline": {
         "description": "Topline for Baseline Risk with finding (INCREASED_RISK or NOT_INCREASED_RISK), text, and details.",
         "type": "array",
         "minItems": 1,
         "maxItems": 1,
         "items": {
            "properties": {
               "finding": {
                  "$ref": "../../core.json#/definitions/PRSToplineFinding"
               },
               "text": {
                  "type": "string",
                  "description": "Text for the topline finding"
               },
               "details": {
                  "type": "string",
                  "description": "Detailed risk description"
               }
            },
            "required": [
               "finding",
               "text",
               "details"
            ]
         },
         "example": [
            {
               "finding": "INCREASED_RISK",
               "text": "Based on the polygenic risk score, this patient has an increased chance of developing breast cancer.\n",
               "details": "This test determined that the patient is at increased risk for breast cancer, defined as a relative risk greater than or equal to 2 times the risk of someone of the same ancestry."
            }
         ]
      }
   }
}