Insurance:
    title: Insurance information
    type: object
    required:
      - policyholder
      - company
      - member_id
      - relationship_to_policyholder
    properties:
      company:
        title: Name of the insurance company
        type: string
      phone:
        title: Insurance company phone
        type: string
      member_id:
        title: Insurance member ID
        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"
      relationship_to_policyholder_other:
        title: "Patient Relationship to Policyholder Other: "
        type: string
      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:
                address:
                  title: Policyholder Address
                  $ref: '../structs.json#/definitions/Address'
    dependencies:
      relationship_to_policyholder:
        oneOf:
          - properties:
              relationship_to_policyholder:
                const: "SELF"
              policyholder:
                properties:
                  prefill_button:
                    type: string
                    title: Prefill Button
          - properties:
              relationship_to_policyholder:
                not:
                  const: "SELF"
