$schema: "https://json-schema.org/draft/2020-12/schema"

title: "MyOme json report"
description: "MyOme report object"
type: "object"

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


definitions:
  NDDCNAVariationClassification:
    type: object
    additionalProperties: false
    required:
      - classification
      - evidence
    properties:
      variantfinding_id:
        $ref: '../../ids.json#/definitions/VariantFindingId'
      finding_type:
        $ref: '../../core.json#/definitions/FindingType'
      classification:
        $ref: '../../core.json#/definitions/ACMGPlusNegativeClassification'
      evidence:
        type: array
        items: 
          type: string
        examples:
          - A pathogenic duplication of the chromosome 22q11.21 region was identified which may be consistent with the clinical signs and symptoms reported for this individual.
      genetic_event:
        $ref: '../../core.json#/definitions/GeneticEventType'
      gene_symbol:
        type: string
      variation:
        type: object
        properties:
          chromosome_region:
            $ref: '../../core.json#/definitions/ChromosomeRegion'
          hgvs_g_37:
            $ref: '../../core.json#/definitions/HGVSExpressionOrNone'
          hgvs_g_38:
            $ref: '../../core.json#/definitions/HGVSExpressionOrNone'
          display:
            type: string
      inheritance:
        type: object
        properties:
          mode:
            title: Mode of Inheritance
            $ref: 'core.json#/definitions/Inheritance'
          zygosity:
            title: Zygosity
            $ref: 'core.json#/definitions/Zygosity'
          pattern:
            title: Inherited From
            $ref: 'core.json#/definitions/VariantInheritance'
      variant_description:
        type: [ "string", "null" ]
      condition:
        type: string
      cytoband:
        $ref: '../../core.json#/definitions/Cytoband'
      iscn_nomenclature:
        $ref: '../../core.json#/definitions/ISCNNomenclature'
      size_mb:
        type: number
        examples:
          - 0.65
          - 2.35
      number_of_genes:
        type: integer
        examples:
          - 6
          - 25
      alleles:
        title: Pathogenic TRE Alleles
        type: array
        minItems: 1
        maxItems: 2
        items:
          $ref: '../../structs.json#/definitions/TREVariationAllele'

    if:
      properties:
        finding_type:
          const: "NDD_CNA_TRE"
    then:
      required:
        - gene_symbol
        - condition
        - inheritance
        - alleles

  NDDCNAReportResults:
    description: >-
      ReportResults is the editable, versioned component of a MyOme
      lab report. 
    type: object
    additionalProperties: false
    required:
      - toplines
      - next_steps
      - classifications
    properties:
      classifications:
        minItems: 1
        type: array
        items:
          $ref: "#/definitions/NDDCNAVariationClassification"
      hpo_terms:
        type: array
        items:
          type: string
        examples:
          - "Seizure" 
          - "Hypertelorism"
      next_steps:
        $ref: "../../structs.json#/definitions/ReportNextSteps"
      toplines:
        $ref: "#/definitions/NDDCNATopline"
      sample_limitations:
        type: array
        items:
          type: string

  NDDCNATopline:
    description: Uses topline finding definition from structs.json.
    type: array
    minItems: 1
    maxItems: 5
    items:
      allOf:
      - $ref: "../../structs.json#/definitions/ToplineFinding"
      - properties:
          finding:
            $ref: "../../core.json#/definitions/RareDiseaseToplineFinding"
    example:
      finding: POSITIVE
      text: A pathogenic variant was identified on chromosome chr1.
