{
   "title": "ClinicianPortalRequisition",
   "type": "object",
   "properties": {
      "rerequisition": {
         "$ref": "../../../ids.json#/definitions/RequisitionId",
         "description": "Original requisition ID for this individual"
      },
      "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": {
                  "$ref": "../../../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 \u2020",
                  "enum": [
                     "PR-2019"
                  ]
               },
               {
                  "$ref": "../../../ids.json#/definitions/ProductId",
                  "title": "Pharmacogenomics Report \u2020",
                  "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. (Max file size: 30MB)",
         "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",
                  "descriptions": [
                     "I confirm the testing ordered herein is medically necessary and recognize that payor determination of medical necessity may vary. The patient (or the minor patient\u2019s legal guardian(s)), as well as relatives included in this order, have consented to testing as may be required by law, including NY CVR \u00a779-l, as applicable, and consent documentation will be made available to Natera upon request. Pre-test counseling for genetic screening was completed according to the patient\u2019s health plan requirements, as applicable. I authorize the referral of this patient to a third-party genetic counseling service if required by the patient\u2019s insurance provider. Post-test counseling will be provided after results are available. I understand that duo or trio testing may reveal findings indicating that sample(s) are not suitable for analysis due to biological discrepancies, including but not limited to nonpaternity or history of a bone marrow transplant.",
                     "By checking the box below as the ordering clinician or authorized signature, I acknowledge that the patient has given informed consent and that I am ordering the test indicated."
                  ],
                  "enum": [
                     "myome:consent:GENERAL"
                  ]
               }
            ]
         }
      },
      "subject": {
         "$ref": "../../Subject.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": "./Billing.json"
      },
      "sample_request": {
         "$ref": "../../../structs.json#/definitions/SampleRequest",
         "default": {
            "send_kit": false
         }
      }
   },
   "required": [
      "clinicians",
      "product_type",
      "product_subtype",
      "product_ids",
      "consents_granted",
      "subject",
      "sample_request",
      "billing"
   ],
   "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_subtype": {
                     "type": "string",
                     "title": "Test Type",
                     "default": "DIAGNOSTIC_RD",
                     "enum": [
                        "DIAGNOSTIC_RD",
                        "DIAGNOSTIC_FVT"
                     ],
                     "enumNames": [
                        "MyOme Rare Disease",
                        "MyOme Family Variant Testing"
                     ]
                  }
               },
               "required": [
                  "product_subtype"
               ]
            }
         ]
      },
      "product_subtype": {
         "oneOf": [
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "PROACTIVE_WGS"
                     ]
                  },
                  "product_ids": {
                     "description": "\u2020 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 \u2020",
                              "enum": [
                                 "PR-2019"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Medication Response \u2020",
                              "enum": [
                                 "PR-2010"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Integrated Risk Coronary Artery Disease \u2020",
                              "enum": [
                                 "PR-2011"
                              ]
                           }
                        ]
                     }
                  }
               }
            },
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "PROACTIVE_BGE"
                     ]
                  },
                  "product_ids": {
                     "description": "\u2020 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 \u2020",
                              "enum": [
                                 "PR-2020"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Medication Response \u2020",
                              "enum": [
                                 "PR-2022"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Integrated Risk Coronary Artery Disease \u2020",
                              "enum": [
                                 "PR-2021"
                              ]
                           }
                        ]
                     }
                  }
               }
            },
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "DIAGNOSTIC_RD"
                     ]
                  },
                  "product_ids": {
                     "maxItems": 1,
                     "description": "\u2020 Product requires minimum age of 1 year",
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "MyOme Neurodevelopmental Delay, Copy Number Analysis \u2020",
                              "enum": [
                                 "PR-2032"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "MyOme Rare Disease, Proband Genome \u2020",
                              "enum": [
                                 "PR-2033"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "MyOme Rare Disease, Trio Genome \u2020",
                              "enum": [
                                 "PR-2034"
                              ]
                           }
                        ]
                     }
                  },
                  "additional_files": {
                     "minItems": 1
                  }
               },
               "required": [
                  "additional_files"
               ]
            },
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "DIAGNOSTIC_FVT"
                     ]
                  },
                  "product_ids": {
                     "maxItems": 1,
                     "default": [
                        "PR1234"
                     ],
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Family Variant Testing",
                              "enum": [
                                 "PR1234"
                              ]
                           }
                        ]
                     }
                  },
                  "relative": {
                     "title": "Relative",
                     "type": "object",
                     "additionalProperties": false,
                     "properties": {
                        "relationship": {
                           "title": "Relationship to Relative",
                           "type": "string",
                           "enum": [
                              "PARENT",
                              "CHILD",
                              "SIBLING",
                              "1ST_COUSIN",
                              "GRANDPARENT",
                              "GRANDCHILD",
                              "AUNT_UNCLE",
                              "NEICE_NEPHEW",
                              "HALF_SIBLING",
                              "OTHER"
                           ],
                           "enumNames": [
                              "Parent",
                              "Child",
                              "Sibling",
                              "1st Cousin",
                              "Grandparent",
                              "Grandchild",
                              "Aunt/Uncle",
                              "Neice/Nephew",
                              "Half-Sibling",
                              "Other (up to 4th degree)"
                           ]
                        },
                        "requisition": {
                           "title": "Order ID",
                           "type": "string",
                           "description": "RQxxxx"
                        },
                        "dob": {
                           "$ref": "../../../core.json#/definitions/Date",
                           "title": "Relative's Date of Birth",
                           "description": "mm/dd/yyyy"
                        }
                     }
                  },
                  "fvt_variants": {
                     "type": "array",
                     "minItems": 1,
                     "uniqueItems": true,
                     "title": "Requested Variants to Test",
                     "default": [
                        "NC_000017.10:g.41197702T"
                     ],
                     "items": {
                        "anyOf": [
                           {
                              "type": "string",
                              "title": "GENE1, c.123, p.123 (Pathogenic)",
                              "enum": [
                                 "NC_000017.10:g.41197702T"
                              ]
                           }
                        ]
                     }
                  }
               },
               "required": [
                  "relative"
               ]
            }
         ]
      }
   }
}