$schema: "https://json-schema.org/draft/2020-12/schema"
title: "Product"
type: "object"

properties:
  productversion_id:
    $ref: '../ids.json#/definitions/ProductVersionId'
  name:
    type:
      string
    description: A short human-readable name of the product
  description:
    description: A short human-readable description of the product (one-line)
    type: string
  long_description:
    description: A human-readable description of the product, typically 1-3 paragraphs
    type: string
  approved_for_reporting:
    description: Is this product approved by the necessary parties to allow report generation
    type: boolean
  clinical_usage:
    $ref: "../core.json#/definitions/ClinicalUsage"
  disclaimers:
    oneOf:
      - type: array
        items:
          type: string
      - type: object
        properties:
          general:
            type: array
            items:
              type: string
          negative:
            type: array
            items:
              type: string
          positive:
            type: array
            items:
              type: string
        additionalProperties: false
  methods:
    type:
      array
    items:
      type: string
  limitations:
    type:
      array
    items:
      type: string
  workflow_id:
    $ref: '../ids.json#/definitions/WorkflowId'
  workflow_config:
    type: "object"
  sequencing_protocol:
    $ref: "../core.json#/definitions/SequencingProtocol"
  report_type:
    $ref: "../core.json#/definitions/ReportType"
  data_required:
    type: array
    description: |
      minimum data required to re-requisition a given product
    items:
      type: object
      $ref: "#/definitions/RequiredAlignmentMetrics"
  consents:
    type: array
    description: List of consents applicable to this product
    items:
      $ref: "../ids.json#/definitions/ConsentUri"
  acceptable_sample_types:
    type: array
    items:
      $ref: "../core.json#/definitions/SampleType"
    minItems: 1
  monogenic_gene_result_conflicts:
    description: Uri containing a list of monogenic gene results that may conflict with the results of a PRS analysis
    $ref: "../ids.json#/definitions/PRSGeneConflictsUri"

required:
  - productversion_id
  - name
  - description
  - approved_for_reporting

examples:
  - productversion_id: 'PR-2008-0.0.1'
    name: 'MyOme Personal Genome, Genetic Health'
    description: MyOme Personal Genome screening based on ACMG secondary findings
    report_type: "MONOGENIC"

definitions:
  RequiredAlignmentMetrics:
    description: |
      required metrics from the alignment dataset
    type: object
    properties:
      dataset_type:
        $ref: "../core.json#/definitions/DataSetType"
      dataset_version:
        $ref: "../core.json#/definitions/Version"
      min_depth:
        type: "number"
        description: minimum sequencing depth
      sequencing_type:
        description: sequencing type
        $ref: "../core.json#/definitions/SequencingType"
