import { BoxSdkError } from '../box/errors.js';
import { sdIsString } from '../serialization/json.js';
import { sdIsMap } from '../serialization/json.js';
export function serializeLegalHoldPolicyAssignedItemTypeField(val) {
    return val;
}
export 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 BoxSdkError({
        message: "Can't deserialize LegalHoldPolicyAssignedItemTypeField",
    });
}
export function serializeLegalHoldPolicyAssignedItem(val) {
    return {
        ['type']: serializeLegalHoldPolicyAssignedItemTypeField(val.type),
        ['id']: val.id,
    };
}
export function deserializeLegalHoldPolicyAssignedItem(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "LegalHoldPolicyAssignedItem"',
        });
    }
    if (val.type == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "type" of type "LegalHoldPolicyAssignedItem" to be defined',
        });
    }
    const type = deserializeLegalHoldPolicyAssignedItemTypeField(val.type);
    if (val.id == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "id" of type "LegalHoldPolicyAssignedItem" to be defined',
        });
    }
    if (!sdIsString(val.id)) {
        throw new BoxSdkError({
            message: 'Expecting string for "id" of type "LegalHoldPolicyAssignedItem"',
        });
    }
    const id = val.id;
    return { type: type, id: id };
}
//# sourceMappingURL=legalHoldPolicyAssignedItem.js.map