fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
63 lines (62 loc) • 2.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppointmentParticipantValidator = AppointmentParticipantValidator;
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 AppointmentParticipant model
*/
const modelFields = (0, definitions_1.createBackboneDefinition)([
{ name: 'type', type: 'CodeableConcept', isArray: true, isRequired: false },
{
name: 'actor',
type: 'Reference',
isArray: false,
isRequired: false,
referenceTypes: [
'Patient',
'Practitioner',
'RelatedPerson',
'PractitionerRole',
'Device',
'HealthcareService',
'Location',
],
},
{
name: 'required',
type: 'code',
isArray: false,
isRequired: false,
enumValues: ['required', 'optional', 'information-only'],
},
{ name: '_required', type: 'Element', isArray: false, isRequired: false },
{
name: 'status',
type: 'code',
isArray: false,
isRequired: true,
enumValues: ['accepted', 'declined', 'tentative', 'needs-action'],
},
{ name: '_status', type: 'Element', isArray: false, isRequired: false },
{ name: 'period', type: 'Period', isArray: false, isRequired: false },
]);
/**
* @description Validates the AppointmentParticipant model
* @param dataToValidate - the AppointmentParticipant model to validate
* @param path - the path to the model
* @param errors - the errors array
*/
function AppointmentParticipantValidator(dataToValidate, path = 'AppointmentParticipant', errors = []) {
// Ensure that the model fields match the attributes of the model
(0, utils_1.AssertModelFieldsMatchAttributes)(modelFields, new models_1.AppointmentParticipant());
// Validate the model and add any errors to the errors array
(0, base_1.ModelValidator)({
dataToValidate,
modelDefinition: modelFields,
path,
errors,
});
}