fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
77 lines (76 loc) • 2.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContactPointBuilder = void 0;
const models_1 = require("../../models");
const ElementBuilder_1 = require("../base/ElementBuilder");
class ContactPointBuilder extends ElementBuilder_1.ElementBuilder {
contactPoint;
constructor() {
super();
this.contactPoint = new models_1.ContactPoint();
}
/**
* @description Add a param extension to the contactPoint
* @param param
* @param extension
* @returns ContactPointBuilder The builder
*/
addPrimitiveExtension(param, extension) {
this.contactPoint[param] = extension;
return this;
}
/**
* @description Set the system property of the contactPoint
* @param value
* @returns ContactPointBuilder The builder
*/
setSystem(value) {
this.contactPoint.system = value;
return this;
}
/**
* @description Set the value property of the contactPoint
* @param value
* @returns ContactPointBuilder The builder
*/
setValue(value) {
this.contactPoint.value = value;
return this;
}
/**
* @description Set the use property of the contactPoint
* @param value
* @returns ContactPointBuilder The builder
*/
setUse(value) {
this.contactPoint.use = value;
return this;
}
/**
* @description Set the rank property of the contactPoint
* @param value
* @returns ContactPointBuilder The builder
*/
setRank(value) {
if (value < 1)
throw new Error('Rank must 1 or up');
this.contactPoint.rank = value;
return this;
}
/**
* @description Set the period property of the contactPoint
* @param value
* @returns ContactPointBuilder The builder
*/
setPeriod(value) {
this.contactPoint.period = value;
return this;
}
/**
* @description Build a ContactPoint
*/
build() {
return Object.assign(this.contactPoint, super.build());
}
}
exports.ContactPointBuilder = ContactPointBuilder;