"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShieldListContentIpV2025R0 = void 0;
exports.serializeShieldListContentIpV2025R0TypeField = serializeShieldListContentIpV2025R0TypeField;
exports.deserializeShieldListContentIpV2025R0TypeField = deserializeShieldListContentIpV2025R0TypeField;
exports.serializeShieldListContentIpV2025R0 = serializeShieldListContentIpV2025R0;
exports.deserializeShieldListContentIpV2025R0 = deserializeShieldListContentIpV2025R0;
exports.serializeShieldListContentIpV2025R0Input = serializeShieldListContentIpV2025R0Input;
exports.deserializeShieldListContentIpV2025R0Input = deserializeShieldListContentIpV2025R0Input;
const errors_1 = require("../../box/errors");
const json_1 = require("../../serialization/json");
const json_2 = require("../../serialization/json");
const json_3 = require("../../serialization/json");
class ShieldListContentIpV2025R0 {
    /**
     * The type of content in the shield list. */
    type = 'ip';
    /**
     * List of ip addresses and CIDRs. */
    ipAddresses;
    rawData;
    constructor(fields) {
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.ipAddresses !== undefined) {
            this.ipAddresses = fields.ipAddresses;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.ShieldListContentIpV2025R0 = ShieldListContentIpV2025R0;
function serializeShieldListContentIpV2025R0TypeField(val) {
    return val;
}
function deserializeShieldListContentIpV2025R0TypeField(val) {
    if (val == 'ip') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize ShieldListContentIpV2025R0TypeField",
    });
}
function serializeShieldListContentIpV2025R0(val) {
    return {
        ['type']: serializeShieldListContentIpV2025R0TypeField(val.type),
        ['ip_addresses']: val.ipAddresses.map(function (item) {
            return item;
        }),
    };
}
function deserializeShieldListContentIpV2025R0(val) {
    if (!(0, json_3.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "ShieldListContentIpV2025R0"',
        });
    }
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "ShieldListContentIpV2025R0" to be defined',
        });
    }
    const type = deserializeShieldListContentIpV2025R0TypeField(val.type);
    if (val.ip_addresses == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "ip_addresses" of type "ShieldListContentIpV2025R0" to be defined',
        });
    }
    if (!(0, json_2.sdIsList)(val.ip_addresses)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "ip_addresses" of type "ShieldListContentIpV2025R0"',
        });
    }
    const ipAddresses = (0, json_2.sdIsList)(val.ip_addresses)
        ? val.ip_addresses.map(function (itm) {
            if (!(0, json_1.sdIsString)(itm)) {
                throw new errors_1.BoxSdkError({
                    message: 'Expecting string for "ShieldListContentIpV2025R0"',
                });
            }
            return itm;
        })
        : [];
    return {
        type: type,
        ipAddresses: ipAddresses,
    };
}
function serializeShieldListContentIpV2025R0Input(val) {
    return {
        ['type']: val.type == void 0
            ? val.type
            : serializeShieldListContentIpV2025R0TypeField(val.type),
        ['ip_addresses']: val.ipAddresses.map(function (item) {
            return item;
        }),
    };
}
function deserializeShieldListContentIpV2025R0Input(val) {
    if (!(0, json_3.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "ShieldListContentIpV2025R0Input"',
        });
    }
    const type = val.type == void 0
        ? void 0
        : deserializeShieldListContentIpV2025R0TypeField(val.type);
    if (val.ip_addresses == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "ip_addresses" of type "ShieldListContentIpV2025R0Input" to be defined',
        });
    }
    if (!(0, json_2.sdIsList)(val.ip_addresses)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "ip_addresses" of type "ShieldListContentIpV2025R0Input"',
        });
    }
    const ipAddresses = (0, json_2.sdIsList)(val.ip_addresses)
        ? val.ip_addresses.map(function (itm) {
            if (!(0, json_1.sdIsString)(itm)) {
                throw new errors_1.BoxSdkError({
                    message: 'Expecting string for "ShieldListContentIpV2025R0Input"',
                });
            }
            return itm;
        })
        : [];
    return {
        type: type,
        ipAddresses: ipAddresses,
    };
}
//# sourceMappingURL=shieldListContentIpV2025R0.js.map