"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Content = void 0;
/**
 * iCure Data Stack API Documentation
 * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
 *
 * OpenAPI spec version: v1
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */
const Measure_1 = require("./Measure");
const Service_1 = require("./Service");
/**
 * Information contained in the service. Content is localized, using ISO language code as key
 */
const ModelHelper_1 = require("./ModelHelper");
class Content {
    constructor(json) {
        let binaryData = {};
        if (!!(json === null || json === void 0 ? void 0 : json.binaryValue)) {
            if (typeof json.binaryValue === 'string') {
                binaryData.binaryValue = (0, ModelHelper_1.b64_2ab)(json.binaryValue);
            }
            else if (json.binaryValue instanceof ArrayBuffer || ArrayBuffer.isView(json.binaryValue)) {
                binaryData.binaryValue = json.binaryValue;
            }
            else if (typeof json.binaryValue === 'object' && Object.keys(json.binaryValue).length === 0) {
                // ignore, will delete after
            }
            else {
                throw new Error(`Invalid type for binaryValue: ${typeof json.binaryValue}`);
            }
        }
        Object.assign(this, json, binaryData);
        if (binaryData.binaryValue === undefined) {
            delete this.binaryValue;
        }
        if (!!(json === null || json === void 0 ? void 0 : json.measureValue)) {
            this.measureValue = new Measure_1.Measure(json.measureValue);
        }
        if (!!(json === null || json === void 0 ? void 0 : json.compoundValue)) {
            this.compoundValue = json.compoundValue.map((service) => new Service_1.Service(service));
        }
    }
}
exports.Content = Content;
//# sourceMappingURL=Content.js.map