"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeShieldRuleItemV2025R0TypeField = serializeShieldRuleItemV2025R0TypeField;
exports.deserializeShieldRuleItemV2025R0TypeField = deserializeShieldRuleItemV2025R0TypeField;
exports.serializeShieldRuleItemV2025R0PriorityField = serializeShieldRuleItemV2025R0PriorityField;
exports.deserializeShieldRuleItemV2025R0PriorityField = deserializeShieldRuleItemV2025R0PriorityField;
exports.serializeShieldRuleItemV2025R0 = serializeShieldRuleItemV2025R0;
exports.deserializeShieldRuleItemV2025R0 = deserializeShieldRuleItemV2025R0;
const utils_1 = require("../../internal/utils");
const utils_2 = require("../../internal/utils");
const errors_1 = require("../../box/errors");
const json_1 = require("../../serialization/json");
const json_2 = require("../../serialization/json");
function serializeShieldRuleItemV2025R0TypeField(val) {
    return val;
}
function deserializeShieldRuleItemV2025R0TypeField(val) {
    if (val == 'shield_rule') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize ShieldRuleItemV2025R0TypeField",
    });
}
function serializeShieldRuleItemV2025R0PriorityField(val) {
    return val;
}
function deserializeShieldRuleItemV2025R0PriorityField(val) {
    if (val == 'informational') {
        return val;
    }
    if (val == 'low') {
        return val;
    }
    if (val == 'medium') {
        return val;
    }
    if (val == 'high') {
        return val;
    }
    if (val == 'critical') {
        return val;
    }
    if ((0, json_1.sdIsString)(val)) {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize ShieldRuleItemV2025R0PriorityField",
    });
}
function serializeShieldRuleItemV2025R0(val) {
    return {
        ['id']: val.id,
        ['type']: val.type == void 0
            ? val.type
            : serializeShieldRuleItemV2025R0TypeField(val.type),
        ['rule_category']: val.ruleCategory,
        ['name']: val.name,
        ['description']: val.description,
        ['priority']: val.priority == void 0
            ? val.priority
            : serializeShieldRuleItemV2025R0PriorityField(val.priority),
        ['created_at']: val.createdAt == void 0
            ? val.createdAt
            : (0, utils_1.serializeDateTime)(val.createdAt),
        ['modified_at']: val.modifiedAt == void 0
            ? val.modifiedAt
            : (0, utils_1.serializeDateTime)(val.modifiedAt),
    };
}
function deserializeShieldRuleItemV2025R0(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "ShieldRuleItemV2025R0"',
        });
    }
    if (!(val.id == void 0) && !(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "ShieldRuleItemV2025R0"',
        });
    }
    const id = val.id == void 0 ? void 0 : val.id;
    const type = val.type == void 0
        ? void 0
        : deserializeShieldRuleItemV2025R0TypeField(val.type);
    if (!(val.rule_category == void 0) && !(0, json_1.sdIsString)(val.rule_category)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "rule_category" of type "ShieldRuleItemV2025R0"',
        });
    }
    const ruleCategory = val.rule_category == void 0 ? void 0 : val.rule_category;
    if (!(val.name == void 0) && !(0, json_1.sdIsString)(val.name)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "name" of type "ShieldRuleItemV2025R0"',
        });
    }
    const name = val.name == void 0 ? void 0 : val.name;
    if (!(val.description == void 0) && !(0, json_1.sdIsString)(val.description)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "description" of type "ShieldRuleItemV2025R0"',
        });
    }
    const description = val.description == void 0 ? void 0 : val.description;
    const priority = val.priority == void 0
        ? void 0
        : deserializeShieldRuleItemV2025R0PriorityField(val.priority);
    if (!(val.created_at == void 0) && !(0, json_1.sdIsString)(val.created_at)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "created_at" of type "ShieldRuleItemV2025R0"',
        });
    }
    const createdAt = val.created_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.created_at);
    if (!(val.modified_at == void 0) && !(0, json_1.sdIsString)(val.modified_at)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "modified_at" of type "ShieldRuleItemV2025R0"',
        });
    }
    const modifiedAt = val.modified_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.modified_at);
    return {
        id: id,
        type: type,
        ruleCategory: ruleCategory,
        name: name,
        description: description,
        priority: priority,
        createdAt: createdAt,
        modifiedAt: modifiedAt,
    };
}
//# sourceMappingURL=shieldRuleItemV2025R0.js.map