"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeEnterpriseFeatureSettingV2025R0FeatureField = serializeEnterpriseFeatureSettingV2025R0FeatureField;
exports.deserializeEnterpriseFeatureSettingV2025R0FeatureField = deserializeEnterpriseFeatureSettingV2025R0FeatureField;
exports.serializeEnterpriseFeatureSettingV2025R0 = serializeEnterpriseFeatureSettingV2025R0;
exports.deserializeEnterpriseFeatureSettingV2025R0 = deserializeEnterpriseFeatureSettingV2025R0;
const userOrGroupReferenceV2025R0_1 = require("./userOrGroupReferenceV2025R0");
const userOrGroupReferenceV2025R0_2 = require("./userOrGroupReferenceV2025R0");
const errors_1 = require("../../box/errors");
const json_1 = require("../../serialization/json");
const json_2 = require("../../serialization/json");
const json_3 = require("../../serialization/json");
const json_4 = require("../../serialization/json");
function serializeEnterpriseFeatureSettingV2025R0FeatureField(val) {
    return { ['id']: val.id };
}
function deserializeEnterpriseFeatureSettingV2025R0FeatureField(val) {
    if (!(0, json_4.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "EnterpriseFeatureSettingV2025R0FeatureField"',
        });
    }
    if (!(val.id == void 0) && !(0, json_2.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "EnterpriseFeatureSettingV2025R0FeatureField"',
        });
    }
    const id = val.id == void 0 ? void 0 : val.id;
    return { id: id };
}
function serializeEnterpriseFeatureSettingV2025R0(val) {
    return {
        ['id']: val.id,
        ['feature']: val.feature == void 0
            ? val.feature
            : serializeEnterpriseFeatureSettingV2025R0FeatureField(val.feature),
        ['state']: val.state,
        ['can_configure']: val.canConfigure,
        ['is_configured']: val.isConfigured,
        ['allowlist']: val.allowlist == void 0
            ? val.allowlist
            : val.allowlist.map(function (item) {
                return (0, userOrGroupReferenceV2025R0_1.serializeUserOrGroupReferenceV2025R0)(item);
            }),
        ['denylist']: val.denylist == void 0
            ? val.denylist
            : val.denylist.map(function (item) {
                return (0, userOrGroupReferenceV2025R0_1.serializeUserOrGroupReferenceV2025R0)(item);
            }),
    };
}
function deserializeEnterpriseFeatureSettingV2025R0(val) {
    if (!(0, json_4.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "EnterpriseFeatureSettingV2025R0"',
        });
    }
    if (!(val.id == void 0) && !(0, json_2.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "EnterpriseFeatureSettingV2025R0"',
        });
    }
    const id = val.id == void 0 ? void 0 : val.id;
    const feature = val.feature == void 0
        ? void 0
        : deserializeEnterpriseFeatureSettingV2025R0FeatureField(val.feature);
    if (!(val.state == void 0) && !(0, json_2.sdIsString)(val.state)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "state" of type "EnterpriseFeatureSettingV2025R0"',
        });
    }
    const state = val.state == void 0 ? void 0 : val.state;
    if (!(val.can_configure == void 0) && !(0, json_1.sdIsBoolean)(val.can_configure)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting boolean for "can_configure" of type "EnterpriseFeatureSettingV2025R0"',
        });
    }
    const canConfigure = val.can_configure == void 0 ? void 0 : val.can_configure;
    if (!(val.is_configured == void 0) && !(0, json_1.sdIsBoolean)(val.is_configured)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting boolean for "is_configured" of type "EnterpriseFeatureSettingV2025R0"',
        });
    }
    const isConfigured = val.is_configured == void 0 ? void 0 : val.is_configured;
    if (!(val.allowlist == void 0) && !(0, json_3.sdIsList)(val.allowlist)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "allowlist" of type "EnterpriseFeatureSettingV2025R0"',
        });
    }
    const allowlist = val.allowlist == void 0
        ? void 0
        : (0, json_3.sdIsList)(val.allowlist)
            ? val.allowlist.map(function (itm) {
                return (0, userOrGroupReferenceV2025R0_2.deserializeUserOrGroupReferenceV2025R0)(itm);
            })
            : [];
    if (!(val.denylist == void 0) && !(0, json_3.sdIsList)(val.denylist)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "denylist" of type "EnterpriseFeatureSettingV2025R0"',
        });
    }
    const denylist = val.denylist == void 0
        ? void 0
        : (0, json_3.sdIsList)(val.denylist)
            ? val.denylist.map(function (itm) {
                return (0, userOrGroupReferenceV2025R0_2.deserializeUserOrGroupReferenceV2025R0)(itm);
            })
            : [];
    return {
        id: id,
        feature: feature,
        state: state,
        canConfigure: canConfigure,
        isConfigured: isConfigured,
        allowlist: allowlist,
        denylist: denylist,
    };
}
//# sourceMappingURL=enterpriseFeatureSettingV2025R0.js.map