$schema: https://json-schema.org/draft/2020-12/schema
type: object
title: MyOme json report for Clinical Risk Only scores
description: MyOme report object for Clinical Risk Only scores

allOf:
  - $ref: base.json
  - properties:
      report_type:
        type: string
        const: PRS
      results:
        $ref: "#/definitions/PRSReportResults"

definitions:
  PRSReportResults:
    description: Extends the properties in PRS Interps by adding toplines, general findings, clinical inputs, and next steps.
    type: object
    allOf:
      - $ref: "../interps/PRS.json#/definitions/ClinicalInterpretation"
      - properties:
          prs_type:
            enum:
              - POOLED_COHORT_EQUATION
            type: "string"
          toplines:
            $ref: "#/definitions/PRSTopline"
          general:
            type: array
            items:
              $ref: "../interps/PRS.json#/definitions/PRSResult"
          next_steps:
            anyOf:
              - $ref: "../../structs.json#/definitions/ReportNextSteps"
              - $ref: "../../structs.json#/definitions/PRSNextSteps"
          sample_limitations:
            type: array
            items:
              type: string
          clinical_risk_inputs:
            $ref: "../interps/PRS.json#/definitions/ClinicalRiskInputs"
          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:
          required: [ "general" ]

  PRSTopline:
    description: Uses topline finding definition from structs.json and reinforces that finding must be PRSToplineFinding since the finding property in ToplineFinding includes PRS and Monogenic enums.
    type: array
    minItems: 1
    maxItems: 1
    items:
      allOf:
        - $ref: "../../structs.json#/definitions/ToplineFinding"
        - properties:
            finding:
              $ref: "../../core.json#/definitions/PRSToplineFinding"
    example:
      - finding: ELEVATED_RISK
        text: Your lifetime risk of developing breast cancer is elevated (greater than or equal to 20%) based on your integrated score.