department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ezr/config/chapters/insuranceInformation/insurancePolicies.js

Summary

Maintainability
C
7 hrs
Test Coverage
import { INSURANCE_VIEW_FIELDS } from '../../../utils/constants';

export default {
  uiSchema: {},
  schema: {
    type: 'object',
    properties: {
      [INSURANCE_VIEW_FIELDS.add]: { type: 'boolean' },
      providers: {
        default: [],
        type: 'array',
        items: {
          type: 'object',
          properties: {
            insuranceName: {
              type: 'string',
              maxLength: 100,
            },
            insurancePolicyHolderName: {
              type: 'string',
              maxLength: 50,
            },
          },
        },
        anyOf: [
          {
            properties: {
              insurancePolicyNumber: {
                type: 'string',
                maxLength: 30,
                pattern: '^.*\\S.*',
              },
            },
            required: ['insurancePolicyNumber'],
          },
          {
            properties: {
              insuranceGroupCode: {
                type: 'string',
                maxLength: 30,
                pattern: '^.*\\S.*',
              },
            },
            required: ['insuranceGroupCode'],
          },
        ],
      },
    },
  },
};