"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeLegalHoldPolicyAssignedItemTypeField = serializeLegalHoldPolicyAssignedItemTypeField;
exports.deserializeLegalHoldPolicyAssignedItemTypeField = deserializeLegalHoldPolicyAssignedItemTypeField;
exports.serializeLegalHoldPolicyAssignedItem = serializeLegalHoldPolicyAssignedItem;
exports.deserializeLegalHoldPolicyAssignedItem = deserializeLegalHoldPolicyAssignedItem;
const errors_1 = require("../box/errors.js");
const json_1 = require("../serialization/json.js");
const json_2 = require("../serialization/json.js");
function serializeLegalHoldPolicyAssignedItemTypeField(val) {
    return val;
}
function deserializeLegalHoldPolicyAssignedItemTypeField(val) {
    if (val == 'file') {
        return val;
    }
    if (val == 'file_version') {
        return val;
    }
    if (val == 'folder') {
        return val;
    }
    if (val == 'user') {
        return val;
    }
    if (val == 'ownership') {
        return val;
    }
    if (val == 'interactions') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize LegalHoldPolicyAssignedItemTypeField",
    });
}
function serializeLegalHoldPolicyAssignedItem(val) {
    return {
        ['type']: serializeLegalHoldPolicyAssignedItemTypeField(val.type),
        ['id']: val.id,
    };
}
function deserializeLegalHoldPolicyAssignedItem(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "LegalHoldPolicyAssignedItem"',
        });
    }
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "LegalHoldPolicyAssignedItem" to be defined',
        });
    }
    const type = deserializeLegalHoldPolicyAssignedItemTypeField(val.type);
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "LegalHoldPolicyAssignedItem" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "LegalHoldPolicyAssignedItem"',
        });
    }
    const id = val.id;
    return { type: type, id: id };
}
//# sourceMappingURL=legalHoldPolicyAssignedItem.js.map