UNPKG

fhirbuilder

Version:
53 lines (52 loc) 2.44 kB
import { IBuildable } from '../base/IBuildable'; import { Repeat } from '../../models'; import { IDuration, IElement, IPeriod, IRange } from 'fhirtypes/dist/r4'; import { DaysOfWeekType, EventTimingType, UnitsOfTimeType } from 'fhirtypes/dist/r4/types'; import { UnderscoreKeys } from '../base/resource-type-map.interface'; import { ElementBuilder } from '../base/ElementBuilder'; interface TypeMap { boundsDuration: IDuration; boundsRange: IRange; boundsPeriod: IPeriod; } type BoundValue<T extends keyof TypeMap> = TypeMap[T]; type PrimitiveExtensionFields = keyof Pick<Repeat, UnderscoreKeys<Repeat>>; interface IRepeatBuilder extends IBuildable<Repeat> { setBounds<T extends keyof TypeMap>(type: T, bounds: BoundValue<T>): this; setCount(count: number): this; setCountMax(countMax: number): this; setDuration(duration: number): this; setDurationMax(durationMax: number): this; setDurationUnit(durationUnit: UnitsOfTimeType): this; setFrequency(frequency: number): this; setFrequencyMax(frequencyMax: number): this; setPeriod(period: number): this; setPeriodMax(periodMax: number): this; setPeriodUnit(periodUnit: UnitsOfTimeType): this; addDayOfWeek(dayOfWeek: DaysOfWeekType): this; addTimeOfDay(timeOfDay: string): this; addWhen(when: EventTimingType): this; setOffset(offset: number): this; } export declare class RepeatBuilder extends ElementBuilder implements IRepeatBuilder { private readonly repeat; constructor(); build(): Repeat; setBounds<T extends keyof TypeMap>(type: T, bounds: BoundValue<T>): this; setCount(count: number): this; setCountMax(countMax: number): this; setDuration(duration: number): this; setDurationMax(durationMax: number): this; setDurationUnit(durationUnit: UnitsOfTimeType): this; setFrequency(frequency: number): this; setFrequencyMax(frequencyMax: number): this; setPeriod(period: number): this; setPeriodMax(periodMax: number): this; setPeriodUnit(periodUnit: UnitsOfTimeType): this; addDayOfWeek(dayOfWeek: DaysOfWeekType): this; addTimeOfDay(timeOfDay: string): this; addWhen(when: EventTimingType): this; setOffset(offset: number): this; addPrimitiveExtension<T extends PrimitiveExtensionFields>(param: T, extension: T extends Extract<PrimitiveExtensionFields, '_when' | '_dayOfWeek' | '_timeOfDay'> ? IElement[] : IElement): this; } export {};