UNPKG

fhirbuilder

Version:
40 lines (39 loc) 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CareTeamParticipantValidator = CareTeamParticipantValidator; const definitions_1 = require("../base/definitions"); const base_1 = require("../base"); const utils_1 = require("../../../commons/utils"); const models_1 = require("../../../../r4/models"); /** * @description The model fields for the CareTeamParticipant model */ const modelFields = (0, definitions_1.createBackboneDefinition)([ { name: 'role', type: 'CodeableConcept', isArray: true, isRequired: false }, { name: 'member', type: 'Reference', isArray: false, isRequired: false, referenceTypes: ['Practitioner', 'PractitionerRole', 'RelatedPerson', 'Patient', 'Organization', 'CareTeam'], }, { name: 'onBehalfOf', type: 'Reference', isArray: false, isRequired: false, referenceTypes: ['Organization'] }, { name: 'period', type: 'Period', isArray: false, isRequired: false }, ]); /** * @description Validates the CareTeamParticipant model * @param dataToValidate - the CareTeamParticipant model to validate * @param path - the path to the model * @param errors - the errors array */ function CareTeamParticipantValidator(dataToValidate, path = 'CareTeamParticipant', errors = []) { // Ensure that the model fields match the attributes of the model (0, utils_1.AssertModelFieldsMatchAttributes)(modelFields, new models_1.CareTeamParticipant()); // Validate the model and add any errors to the errors array (0, base_1.ModelValidator)({ dataToValidate, modelDefinition: modelFields, path, errors, }); }