diff --git a/dist/21P-530V2-schema.json b/dist/21P-530V2-schema.json new file mode 100644 index 000000000..71e878fa7 --- /dev/null +++ b/dist/21P-530V2-schema.json @@ -0,0 +1,535 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "APPLICATION FOR BURIAL BENEFITS", + "type": "object", + "additionalProperties": false, + "definitions": { + "dateRange": { + "type": "object", + "properties": { + "from": { + "$ref": "#/definitions/date" + }, + "to": { + "$ref": "#/definitions/date" + } + } + }, + "privacyAgreementAccepted": { + "type": "boolean", + "enum": [ + true + ] + }, + "centralMailAddress": { + "type": "object", + "oneOf": [ + { + "properties": { + "country": { + "type": "string", + "enum": [ + "CAN" + ] + }, + "state": { + "type": "string", + "enum": [ + "AB", + "BC", + "MB", + "NB", + "NF", + "NT", + "NV", + "NU", + "ON", + "PE", + "QC", + "SK", + "YT" + ] + }, + "postalCode": { + "type": "string", + "maxLength": 10 + } + } + }, + { + "properties": { + "country": { + "type": "string", + "enum": [ + "MEX" + ] + }, + "state": { + "type": "string", + "enum": [ + "aguascalientes", + "baja-california-norte", + "baja-california-sur", + "campeche", + "chiapas", + "chihuahua", + "coahuila", + "colima", + "distrito-federal", + "durango", + "guanajuato", + "guerrero", + "hidalgo", + "jalisco", + "mexico", + "michoacan", + "morelos", + "nayarit", + "nuevo-leon", + "oaxaca", + "puebla", + "queretaro", + "quintana-roo", + "san-luis-potosi", + "sinaloa", + "sonora", + "tabasco", + "tamaulipas", + "tlaxcala", + "veracruz", + "yucatan", + "zacatecas" + ] + }, + "postalCode": { + "type": "string", + "maxLength": 10 + } + } + }, + { + "properties": { + "country": { + "type": "string", + "enum": [ + "USA" + ] + }, + "state": { + "type": "string", + "enum": [ + "AL", + "AK", + "AS", + "AZ", + "AR", + "AA", + "AE", + "AP", + "CA", + "CO", + "CT", + "DE", + "DC", + "FM", + "FL", + "GA", + "GU", + "HI", + "ID", + "IL", + "IN", + "IA", + "KS", + "KY", + "LA", + "ME", + "MH", + "MD", + "MA", + "MI", + "MN", + "MS", + "MO", + "MT", + "NE", + "NV", + "NH", + "NJ", + "NM", + "NY", + "NC", + "ND", + "MP", + "OH", + "OK", + "OR", + "PW", + "PA", + "PR", + "RI", + "SC", + "SD", + "TN", + "TX", + "UT", + "VT", + "VI", + "VA", + "WA", + "WV", + "WI", + "WY" + ] + }, + "postalCode": { + "type": "string", + "pattern": "^(\\d{5})(?:[-](\\d{4}))?$" + } + } + }, + { + "properties": { + "country": { + "not": { + "type": "string", + "enum": [ + "CAN", + "MEX", + "USA" + ] + } + }, + "state": { + "type": "string", + "maxLength": 51 + }, + "postalCode": { + "type": "string", + "maxLength": 51 + } + } + } + ], + "properties": { + "street": { + "type": "string", + "minLength": 1, + "maxLength": 50 + }, + "street2": { + "type": "string", + "minLength": 1, + "maxLength": 50 + }, + "city": { + "type": "string", + "minLength": 1, + "maxLength": 51 + } + }, + "required": [ + "postalCode" + ] + }, + "usaPhone": { + "type": "string", + "pattern": "^\\d{10}$" + }, + "fullName": { + "type": "object", + "properties": { + "first": { + "type": "string", + "minLength": 1, + "maxLength": 30 + }, + "middle": { + "type": "string" + }, + "last": { + "type": "string", + "minLength": 1, + "maxLength": 30 + }, + "suffix": { + "type": "string", + "enum": [ + "Jr.", + "Sr.", + "II", + "III", + "IV" + ] + } + }, + "required": [ + "first", + "last" + ] + }, + "ssn": { + "type": "string", + "pattern": "^[0-9]{9}$" + }, + "centralMailVaFile": { + "type": "string", + "pattern": "^\\d{8,9}$" + }, + "date": { + "pattern": "^(\\d{4}|XXXX)-(0[1-9]|1[0-2]|XX)-(0[1-9]|[1-2][0-9]|3[0-1]|XX)$", + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "confirmationCode": { + "type": "string" + } + } + } + } + }, + "anyOf": [ + { + "required": [ + "vaFileNumber" + ] + }, + { + "required": [ + "veteranSocialSecurityNumber" + ] + } + ], + "properties": { + "relationship": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "spouse", + "child", + "parent", + "executor", + "funeralDirector", + "other" + ] + }, + "other": { + "type": "string" + }, + "isEntity": { + "type": "boolean" + } + } + }, + "locationOfDeath": { + "type": "object", + "required": [ + "location" + ], + "properties": { + "location": { + "type": "string", + "enum": [ + "atHome", + "nursingHomePaid", + "nursingHomeUnpaid", + "vaMedicalCenter", + "stateVeteransHome", + "otherFamilyOrFriend", + "other" + ] + }, + "nursingHomePaid": { + "type": "object", + "properties": { + "facilityName": { + "type": "string" + }, + "facilityLocation": { + "type": "string" + } + } + }, + "vaMedicalCenter": { + "type": "object", + "properties": { + "facilityName": { + "type": "string" + }, + "facilityLocation": { + "type": "string" + } + } + }, + "stateVeteransHome": { + "type": "object", + "properties": { + "facilityName": { + "type": "string" + }, + "facilityLocation": { + "type": "string" + } + } + }, + "other": { + "type": "string" + } + } + }, + "toursOfDuty": { + "type": "array", + "items": { + "type": "object", + "properties": { + "dateRange": { + "$ref": "#/definitions/dateRange" + }, + "serviceBranch": { + "type": "string" + }, + "rank": { + "type": "string" + }, + "serviceNumber": { + "type": "string" + }, + "placeOfEntry": { + "type": "string" + }, + "placeOfSeparation": { + "type": "string" + } + } + } + }, + "previousNames": { + "type": "array", + "items": { + "$ref": "#/definitions/fullName" + } + }, + "claimantEmail": { + "type": "string", + "format": "email" + }, + "burialAllowance": { + "type": "boolean" + }, + "plotAllowance": { + "type": "boolean" + }, + "transportation": { + "type": "boolean" + }, + "amountIncurred": { + "type": "number" + }, + "burialAllowanceRequested": { + "type": "string", + "enum": [ + "service", + "nonService", + "vaMC" + ] + }, + "burialCost": { + "type": "number" + }, + "previouslyReceivedAllowance": { + "type": "boolean" + }, + "benefitsUnclaimedRemains": { + "type": "boolean" + }, + "placeOfRemains": { + "type": "string" + }, + "federalCemetery": { + "type": "boolean" + }, + "stateCemetery": { + "type": "boolean" + }, + "govtContributions": { + "type": "boolean" + }, + "amountGovtContribution": { + "type": "number" + }, + "placeOfBirth": { + "type": "string" + }, + "officialPosition": { + "type": "string" + }, + "firmName": { + "type": "string" + }, + "privacyAgreementAccepted": { + "$ref": "#/definitions/privacyAgreementAccepted" + }, + "claimantAddress": { + "$ref": "#/definitions/centralMailAddress" + }, + "claimantPhone": { + "$ref": "#/definitions/usaPhone" + }, + "claimantFullName": { + "$ref": "#/definitions/fullName" + }, + "veteranFullName": { + "$ref": "#/definitions/fullName" + }, + "claimantSocialSecurityNumber": { + "$ref": "#/definitions/ssn" + }, + "veteranSocialSecurityNumber": { + "$ref": "#/definitions/ssn" + }, + "vaFileNumber": { + "$ref": "#/definitions/centralMailVaFile" + }, + "burialDate": { + "$ref": "#/definitions/date" + }, + "deathDate": { + "$ref": "#/definitions/date" + }, + "claimantDateOfBirth": { + "$ref": "#/definitions/date" + }, + "veteranDateOfBirth": { + "$ref": "#/definitions/date" + }, + "militarySeparationDocuments": { + "$ref": "#/definitions/files" + }, + "deathCertificate": { + "$ref": "#/definitions/files" + }, + "transportationReceipts": { + "$ref": "#/definitions/files" + } + }, + "required": [ + "privacyAgreementAccepted", + "claimantAddress", + "veteranFullName" + ] +} diff --git a/src/schemas/21P-530v2/schema.js b/src/schemas/21P-530v2/schema.js new file mode 100644 index 000000000..f13db7bb4 --- /dev/null +++ b/src/schemas/21P-530v2/schema.js @@ -0,0 +1,200 @@ +import _ from 'lodash'; +import originalDefinitions from '../../common/definitions'; +import schemaHelpers from '../../common/schema-helpers'; + +const definitions = _.cloneDeep(originalDefinitions); +const modifiedToursOfDuty = definitions.toursOfDuty; +delete modifiedToursOfDuty.items.properties.benefitsToApplyTo; +delete modifiedToursOfDuty.items.properties.applyPeriodToSelected; +delete modifiedToursOfDuty.items.properties.serviceStatus; +delete modifiedToursOfDuty.items.required; + +_.merge(modifiedToursOfDuty, { + items: { + properties: { + rank: { + type: 'string', + }, + serviceNumber: { + type: 'string', + }, + placeOfEntry: { + type: 'string', + }, + placeOfSeparation: { + type: 'string', + }, + }, + }, +}); + +const schema = { + $schema: 'http://json-schema.org/draft-04/schema#', + title: 'APPLICATION FOR BURIAL BENEFITS', + type: 'object', + additionalProperties: false, + definitions: { + dateRange: definitions.dateRange, + }, + anyOf: [ + { + required: ['vaFileNumber'], + }, + { + required: ['veteranSocialSecurityNumber'], + }, + ], + properties: { + relationship: { + type: 'object', + required: ['type'], + properties: { + type: { + type: 'string', + enum: ['spouse', 'child', 'parent', 'executor', 'funeralDirector', 'other'], + }, + other: { + type: 'string', + }, + isEntity: { + type: 'boolean', + }, + }, + }, + locationOfDeath: { + type: 'object', + required: ['location'], + properties: { + location: { + type: 'string', + enum: [ + 'atHome', + 'nursingHomePaid', + 'nursingHomeUnpaid', + 'vaMedicalCenter', + 'stateVeteransHome', + 'otherFamilyOrFriend', + 'other', + ], + }, + nursingHomePaid: { + type: 'object', + properties: { + facilityName: { + type: 'string', + }, + facilityLocation: { + type: 'string', + }, + }, + }, + vaMedicalCenter: { + type: 'object', + properties: { + facilityName: { + type: 'string', + }, + facilityLocation: { + type: 'string', + }, + }, + }, + stateVeteransHome: { + type: 'object', + properties: { + facilityName: { + type: 'string', + }, + facilityLocation: { + type: 'string', + }, + }, + }, + other: { + type: 'string', + }, + }, + }, + toursOfDuty: modifiedToursOfDuty, + previousNames: { + type: 'array', + items: schemaHelpers.getDefinition('fullName'), + }, + claimantEmail: { + type: 'string', + format: 'email', + }, + burialAllowance: { + type: 'boolean', + }, + plotAllowance: { + type: 'boolean', + }, + transportation: { + type: 'boolean', + }, + amountIncurred: { + type: 'number', + }, + burialAllowanceRequested: { + type: 'string', + enum: ['service', 'nonService', 'vaMC'], + }, + burialCost: { + type: 'number', + }, + previouslyReceivedAllowance: { + type: 'boolean', + }, + benefitsUnclaimedRemains: { + type: 'boolean', + }, + placeOfRemains: { + type: 'string', + }, + federalCemetery: { + type: 'boolean', + }, + stateCemetery: { + type: 'boolean', + }, + govtContributions: { + type: 'boolean', + }, + amountGovtContribution: { + type: 'number', + }, + placeOfBirth: { + type: 'string', + }, + officialPosition: { + type: 'string', + }, + firmName: { + type: 'string', + }, + }, + required: ['privacyAgreementAccepted', 'claimantAddress', 'veteranFullName'], +}; + +[ + ['privacyAgreementAccepted'], + ['centralMailAddress', 'claimantAddress'], + ['usaPhone', 'claimantPhone'], + ['fullName', 'claimantFullName'], + ['fullName', 'veteranFullName'], + ['ssn', 'claimantSocialSecurityNumber'], + ['ssn', 'veteranSocialSecurityNumber'], + ['centralMailVaFile', 'vaFileNumber'], + ['date', 'burialDate'], + ['date', 'deathDate'], + ['date', 'claimantDateOfBirth'], + ['date', 'veteranDateOfBirth'], + ['files', 'militarySeparationDocuments'], + ['files', 'deathCertificate'], + ['files', 'transportationReceipts'], +].forEach(args => { + schemaHelpers.addDefinitionToSchema(schema, ...args); +}); + +export default schema;