title: "NDD CNA Report Writing"
type: "object"

properties:
  toplines:
    title: Topline Finding(s)
    type: array
    minItems: 1
    maxItems: 5
    items:
      allOf:
      - $ref: "../../structs.json#/definitions/ToplineFinding"
      - properties:
          finding:
            $ref: "../../core.json#/definitions/MonogenicToplineFinding"
  next_steps:
    $ref: "../../structs.json#/definitions/ReportNextSteps"
  classifications:
    title: Classifications
    minItems: 1
    type: array
    items:
      allOf:
        - type: object
          properties:
            finding_type:
              $ref: '../../core.json#/definitions/FindingType'
            classification:
              $ref: '../../core.json#/definitions/ACMGPlusNegativeClassification'
        - allOf:
            - if:
                properties:
                  classification:
                    const: "NEGATIVE"
              then:
                $ref: '#/definitions/NDDCNANegativeClassification'
            - if:
                properties:
                  finding_type:
                    const: "NDD_CNA"
              then:
                $ref: '#/definitions/NDDCNAVariationClassification'
            - if:
                properties:
                  finding_type:
                    const: "NDD_CNA_TRE"
              then:
                $ref: '#/definitions/NDDCNATREClassification'
  sample_limitations:
    title: Sample Limitations
    type: array
    items:
      type: string

definitions:
  NDDCNANegativeClassification:
    type: object
    required:
      - classification
    properties:
      classification:
        const: "NEGATIVE"

  NDDCNAVariationClassification:
    type: object
    additionalProperties: false
    required:
      - classification
      - evidence
    properties:
      variantfinding_id:
        $ref: '../../ids.json#/definitions/VariantFindingId'
      finding_type:
        const: "NDD_CNA"
      classification:
        title: ACMG Classification
        $ref: '../../core.json#/definitions/ACMGPlusNegativeClassification'
      evidence:
        title: Evidence
        type: array
        items: 
          type: string
      genetic_event:
        title: Genetic Event
        $ref: '../../core.json#/definitions/GeneticEventType'
      variation:
        type: object
        properties:
          chromosome_region:
            title: Chromosome Region
            $ref: '../../core.json#/definitions/ChromosomeRegion'
      cytoband:
        title: Cytoband
        $ref: '../../core.json#/definitions/Cytoband'
      iscn_nomenclature:
        title: ISCN Nomenclature
        $ref: '../../core.json#/definitions/ISCNNomenclature'
      size_mb:
        title: Size (mb)
        type: number
      number_of_genes:
        title: No. Genes
        type: integer

  NDDCNATREClassification:
    type: object
    additionalProperties: false
    required:
      - classification
    properties:
      variantfinding_id:
        $ref: '../../ids.json#/definitions/VariantFindingId'
      finding_type:
        const: "NDD_CNA_TRE"
      gene_symbol:
        title: Location (Gene Symbol)
        type: string
      condition:
        title: Condition
        type: string
      alleles:
        title: Alleles
        type: array
        items:
          type: object
          properties:
            event:
              title: Variant Event
              type: string
            classification:
              title: Allele Classification
              $ref: '../../core.json#/definitions/ACMGPlusNegativeClassification'
            number:
              type: integer
      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'
      classification:
        title: ACMG Classification
        $ref: '../../core.json#/definitions/ACMGPlusNegativeClassification'
      evidence:
        title: Interpretation Summary
        type: array
        items: 
          type: string
      variation:
        type: object
        properties:
          display:
            type: string
      variant_description:
        title: Evidence
        type: [ "string", "null" ]
      gene_info:
        title: Gene Information
        type: [ "string", "null" ]