"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Measure = void 0;
const ReferenceRange_1 = require("./ReferenceRange");
class Measure {
    /**
     * We delete min and max from the json and create a referenceRanges from it
     * Since this is a shallow copy, deletion of min and max will have no effect on the original json since it's the top level fields
     *
     * @param json
     */
    constructor(json) {
        const measureValue = Object.assign({}, json);
        if (!!(measureValue === null || measureValue === void 0 ? void 0 : measureValue.min) || !!(measureValue === null || measureValue === void 0 ? void 0 : measureValue.max)) {
            measureValue.referenceRanges = [
                new ReferenceRange_1.ReferenceRange({
                    low: measureValue.min,
                    high: measureValue.max,
                }),
            ];
            measureValue === null || measureValue === void 0 ? true : delete measureValue.min;
            measureValue === null || measureValue === void 0 ? true : delete measureValue.max;
        }
        Object.assign(this, measureValue);
    }
}
exports.Measure = Measure;
//# sourceMappingURL=Measure.js.map