"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeResourceScopeScopeField = serializeResourceScopeScopeField;
exports.deserializeResourceScopeScopeField = deserializeResourceScopeScopeField;
exports.serializeResourceScope = serializeResourceScope;
exports.deserializeResourceScope = deserializeResourceScope;
const resource_1 = require("./resource");
const resource_2 = require("./resource");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
function serializeResourceScopeScopeField(val) {
    return val;
}
function deserializeResourceScopeScopeField(val) {
    if (val == 'annotation_edit') {
        return val;
    }
    if (val == 'annotation_view_all') {
        return val;
    }
    if (val == 'annotation_view_self') {
        return val;
    }
    if (val == 'base_explorer') {
        return val;
    }
    if (val == 'base_picker') {
        return val;
    }
    if (val == 'base_preview') {
        return val;
    }
    if (val == 'base_upload') {
        return val;
    }
    if (val == 'item_delete') {
        return val;
    }
    if (val == 'item_download') {
        return val;
    }
    if (val == 'item_preview') {
        return val;
    }
    if (val == 'item_rename') {
        return val;
    }
    if (val == 'item_share') {
        return val;
    }
    if (val == 'item_upload') {
        return val;
    }
    if (val == 'item_read') {
        return val;
    }
    if ((0, json_1.sdIsString)(val)) {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize ResourceScopeScopeField",
    });
}
function serializeResourceScope(val) {
    return {
        ['scope']: val.scope == void 0
            ? val.scope
            : serializeResourceScopeScopeField(val.scope),
        ['object']: val.object == void 0 ? val.object : (0, resource_1.serializeResource)(val.object),
    };
}
function deserializeResourceScope(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "ResourceScope"' });
    }
    const scope = val.scope == void 0
        ? void 0
        : deserializeResourceScopeScopeField(val.scope);
    const object = val.object == void 0 ? void 0 : (0, resource_2.deserializeResource)(val.object);
    return { scope: scope, object: object };
}
//# sourceMappingURL=resourceScope.js.map