definitions:
  Insurance:
    title: Insurance information
    type: object
    unevaluatedProperties: false
    required:
      - company
      - member_id
      - relationship_to_policyholder
    properties:
      company:
        title: Name of Insurance Company
        type: string
      phone:
        title: Insurance Phone Number
        type: string
      member_id:
        title: Member ID
        type: string
      group_number:
        title: Group Number
        type: string
      prior_auth_number:
        title: Prior Authorization Number
        type: string
      relationship_to_policyholder:
        title: "Patient Relationship to Policyholder"
        description: ""
        $ref: "../core.json#/definitions/Relationship"
      epsdt_coverage:
        title: EPSDT Coverage
        description: "If the patient is under 21 years old and has a Medicaid plan, please provide the following information for Early and Periodic Screening, Diagnosis, and Treatment (EPSDT) coverage."
        type: object
        properties:
          medicaid_plan:
            title: Medicaid Plan
            type: string
          medicaid_number:
            title: Medicaid Number
            type: string
          attestations:
            title: "I attest that test results will impact medical management, including treatment or care decisions as follows:"
            type: array
            items:
              type: string
              enum:
                - "My patient may be eligible for specific drug therapies or clinical trials"
                - "My patient may be referred for additional medical consultations and/or support services for additional treatments and surveillance"
                - "My patient's medication may change if genetic findings indicate risk for adverse reactions or poor drug metabolism"
            uniqueItems: true
    dependencies:
      relationship_to_policyholder:
        oneOf:
          - properties:
              relationship_to_policyholder:
                enum:
                  - SELF
          - properties:
              relationship_to_policyholder:
                enum:
                  - SPOUSE
                  - CHILD
                  - DEPENDENT_HANDICAPPED
                  - DEPENDENT_SPONSORED
                  - DEPENDENT_OF_MINOR_DEPENDENT
                  - EMPLOYEE
                  - FOSTER_CHILD
                  - GRANDCHILD
                  - GRANDPARENT
                  - NEPHEW_OR_NIECE
                  - STEPCHILD
                  - UNKNOWN
                  - WARD_OF_COURT
              policyholder:
                $ref: "#/definitions/Policyholder"
            required:
              - policyholder
          - properties:
              relationship_to_policyholder:
                enum:
                  - OTHER
              relationship_to_policyholder_other:
                title: "Patient Relationship to Policyholder Other"
                type: string
              policyholder:
                $ref: "#/definitions/Policyholder"
            required:
              - relationship_to_policyholder_other
          

  Policyholder:
    title: Policyholder
    type: object
    required:
      - name
      - demographics
    properties:
      name:
        title: Policy Holder Name
        $ref: "../structs.json#/definitions/Name"
        required:
          - first
          - last
      demographics:
        title: Demographics
        type: object
        required:
          - dob
          - sex
        properties:
          dob:
            title: Policyholder Date of Birth
            $ref: '../core.json#/definitions/Date'
            description: 'mm/dd/yyyy'
          sex:
            title: Policyholder Sex
            $ref: '../core.json#/definitions/BiologicalSex'
      contact_info:
        title: Contact Info
        type: array
        minItems: 1
        maxItems: 1
        items:
          type: object
          required:
            - address
          properties:
            prefill_button:
              type: string
              title: Prefill Button
            address:
              title: Policyholder Address
              $ref: '../structs.json#/definitions/Address'