fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
52 lines (51 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PeriodBuilder = void 0;
const models_1 = require("../../models");
const ElementBuilder_1 = require("../base/ElementBuilder");
/**
* @description Class to build a Period instance with the builder pattern
*/
class PeriodBuilder extends ElementBuilder_1.ElementBuilder {
period;
constructor() {
super();
this.period = new models_1.Period();
}
/**
* @description Adds a parameter extension to the period
* @param param - The parameter name ('start' or 'end')
* @param extension - The extension to add
* @returns The instance of PeriodBuilder for method chaining
*/
addPrimitiveExtension(param, extension) {
this.period[param] = extension;
return this;
}
/**
* @description Sets the start date of the period
* @param value - The start date as a string
* @returns The instance of PeriodBuilder for method chaining
*/
setStart(value) {
this.period.start = value;
return this;
}
/**
* @description Sets the end date of the period
* @param value - The end date as a string
* @returns The instance of PeriodBuilder for method chaining
*/
setEnd(value) {
this.period.end = value;
return this;
}
/**
* @description Builds and returns the Period instance
* @returns The built Period instance
*/
build() {
return Object.assign(this.period, super.build());
}
}
exports.PeriodBuilder = PeriodBuilder;