title: "ClinicianPortalRequisition"
type: "object"

properties:
  rerequisition:
    $ref: "../../../ids.json#/definitions/RequisitionId"
  campaign_code:
    type: string
    title: "Campaign Code"
  clinicians:
    type: array
    title: Clinicians
    description: Start typing to autocomplete, must select at least 1 clinician
    minItems: 1
    uniqueItems: true
    items:
      type: object
      properties:
        label:
          type: string
        id:
          type: string
          pattern: "../../../ids.json#/definitions/ClinicianId"
  preferred_report_delivery:
    $ref: "../../../core.json#/definitions/PreferredReportDeliveryMethod"
    default: EMAIL
  product_type:
    type: string
    title: Clinical Area
    default: PROACTIVE
    enum:
      - PROACTIVE
      - DIAGNOSTIC
    enumNames:
      - Proactive
      - Diagnostic
  product_ids:
    type: array
    title: Tests
    minItems: 1
    uniqueItems: true
    items:
      anyOf:
      - $ref: "../../../ids.json#/definitions/ProductId"
        title: Proactive Health Report †
        enum:
        - PR-2019
      - $ref: "../../../ids.json#/definitions/ProductId"
        title: Pharmacogenomics Report †
        enum:
        - PR-3009
      - $ref: "../../../ids.json#/definitions/ProductId"
        title: Neurodevelopmental Delay Copy Number Analysis Report
        enum:
        - PR-5004
  pre_test_counseling:
    title: Pre-Test Genetic Counseling
    type: string
    $ref: "../../../core.json#/definitions/PreTestCounselingType"
    default: NO_COUNSELING
  post_test_counseling:
    title: Post-Test Genetic Counseling
    type: string
    $ref: "../../../core.json#/definitions/PostTestCounselingType"
    default: NO_COUNSELING
  indications:
    title: Clinical Indications
    description: Indicate reasons for testing
    type: string
    default: ""
  additional_files:
    title: File Upload
    description: Clinical Notes, Insurance Cards, Letter of Medical Necessity, etc
    type: array
    uniqueItems: true
    items:
      type: string
      format: 'data-url'
  consents_granted:
    type: array
    title: Consents
    minItems: 1
    maxItems: 1
    uniqueItems: true
    items:
      anyOf:
      - $ref: "../../../ids.json#/definitions/ConsentUri"
        title: Signed Provider Attestation
        description: By checking this box, the medical professional acknowledges that the individual/guardian authorized to make decisions for the individual (collectively, the Patient) has been supplied information regarding and consented to undergo the genetic testing ordered including genetic counseling by MyOme or its affiliates, substantially as set forth in the Informed Consent for Genetic Testing, and/or as required by applicable law, and the Patient has been informed that MyOme and its affiliates may notify them of clinical updates related to genetic test results (in consultation with the ordering medical professional). For orders originating outside the USA, the Patient has been informed that their personal information and specimen will be transferred to and processed in the USA.
        enum:
        - myome:consent:GENERAL
  subject:
    $ref: "./CatalystSubject.json"
  remote_mrn:
    type: string
    title: Patient ID MRN
    description: Clinic's Medical Record Number
    default: ""
  guardian:
    title: Parent or Guardian (required for minors)
    type: object
    properties:
      name:
        $ref: "../../../structs.json#/definitions/Name"
        title: Parent or Guardian Name
        default: {first: "", last: "", middle: ""}
      relationship_to_patient:
        title: Parent or Guardian Relationship to Patient
        type: string
        default: ""
        examples:
          - Mother
          - Father
          - Legal Guardian
  billing:
    $ref: "../../../structs.json#/definitions/BillingInstitutional"
  sample_request:
    $ref: '../../../structs.json#/definitions/SampleRequest'
    default:
      type: BLOOD
      send_kit: false
  campaign_information:
    title: Catalyst Program Information
    type: object
    properties:
      participant_id:
        type: string
        title: Catalyst Participant Identifier
      sample_id:
        type: string
        title: Catalyst Sample Identifier
      collection_date:
        $ref: "../../../core.json#/definitions/Date"
        title: Sample Collection Date
    required:
      - participant_id
      - sample_id
      - collection_date
required:
  - clinicians
  - product_type
  - product_ids
  - consents_granted
  - subject
  - sample_request
  - billing
  - campaign_information
additionalProperties: false

dependencies:
  product_type:
    oneOf:
      - properties:
          product_type:
            enum:
            - PROACTIVE
          product_subtype:
            type: string
            title: Test Type
            default: PROACTIVE_WGS
            enum:
              - PROACTIVE_WGS
              - PROACTIVE_BGE
            enumNames:
              - MyOme Proactive Health Plus
              - MyOme Proactive Health
        required:
          - product_subtype
      - properties:
          product_type:
            enum:
            - DIAGNOSTIC
          product_ids:
            maxItems: 1
            description: "† Product requires minimum age of 1 year"
            items:
              anyOf:
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: MyOme Neurodevelopmental Delay, Copy Number Analysis †
                  enum:
                  - PR-2032
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: MyOme Rare Disease, Proband Genome †
                  enum:
                  - PR-2033
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: MyOme Rare Disease, Trio Genome †
                  enum:
                  - PR-2034
          additional_files:
            minItems: 1
        required:
          - additional_files
  product_subtype:
    oneOf:
      - properties:
          product_subtype:
            enum:
              - PROACTIVE_WGS
          product_ids:
            description: "† Product requires minimum age of 18 years"
            default:
              - PR-2019
              - PR-2010
            items:
              anyOf:
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: Single-Gene Risk, 151 Genes †
                  enum:
                  - PR-2019
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: Medication Response †
                  enum:
                  - PR-2010
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: Integrated Risk Coronary Artery Disease †
                  enum:
                  - PR-2011
      - properties:
          product_subtype:
            enum:
              - PROACTIVE_BGE
          product_ids:
            description: "† Product requires minimum age of 18 years"
            default:
              - PR-2020
              - PR-2021
            items:
              anyOf:
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: Single-Gene Risk, 84 Genes †
                  enum:
                  - PR-2020
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: Medication Response †
                  enum:
                  - PR-2022
                - $ref: "../../../ids.json#/definitions/ProductId"
                  title: Integrated Risk Coronary Artery Disease †
                  enum:
                  - PR-2021