UNPKG

fhirbuilder

Version:
89 lines (88 loc) 3.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthcareServiceAvailableTimeBuilder = void 0; const models_1 = require("../../models"); const base_1 = require("../base"); /** * @version R4 (v4.0.1) * @summary FHIR® Specification by HL7® * @description Class for building a HealthcareServiceAvailableTime * @class HealthcareServiceAvailableTimeBuilder * @extends {BackboneBuilder} * @implements {IHealthcareServiceAvailableTimeBuilder} * @author Roberto Araneda Espinoza */ class HealthcareServiceAvailableTimeBuilder extends base_1.BackboneBuilder { healthcareServiceAvailableTime; constructor() { super(); this.healthcareServiceAvailableTime = new models_1.HealthcareServiceAvailableTime(); } /** * @description Adds a primitive extension to the element * @param param - the field to add the extension to * @param extension - the extension to add * @returns {this} * @example addPrimitiveExtension('_value', { value: 'test' }) */ addPrimitiveExtension(param, extension) { const arrayParam = ['_daysOfWeek']; if (arrayParam.includes(param)) { this.healthcareServiceAvailableTime[param] = this.healthcareServiceAvailableTime[param] || []; this.healthcareServiceAvailableTime[param].push(extension); return this; } const localParam = param; this.healthcareServiceAvailableTime[localParam] = extension; return this; } /** * @description Builds the model * @returns {HealthcareServiceAvailableTime} */ build() { return Object.assign(this.healthcareServiceAvailableTime, super.build()); } /** * @description Adds a value to the daysOfWeek array * @description Indicates which days of the week are available between the start and end Times. * @param value - the value to add * @returns {this} */ addDaysOfWeek(value) { this.healthcareServiceAvailableTime.daysOfWeek = this.healthcareServiceAvailableTime.daysOfWeek || []; this.healthcareServiceAvailableTime.daysOfWeek.push(value); return this; } /** * @description Sets the allDay value * @description Is this always available? (hence times are irrelevant) e.g. 24 hour service. * @param value - the value to set * @returns {this} */ setAllDay(value) { this.healthcareServiceAvailableTime.allDay = value; return this; } /** * @description Sets the availableStartTime value * @description The opening time of day. Note: If the AllDay flag is set, then this time is ignored. * @param value - the value to set * @returns {this} */ setAvailableStartTime(value) { this.healthcareServiceAvailableTime.availableStartTime = value; return this; } /** * @description Sets the availableEndTime value * @description The closing time of day. Note: If the AllDay flag is set, then this time is ignored. * @param value - the value to set * @returns {this} */ setAvailableEndTime(value) { this.healthcareServiceAvailableTime.availableEndTime = value; return this; } } exports.HealthcareServiceAvailableTimeBuilder = HealthcareServiceAvailableTimeBuilder;