"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignRequestSignerInputZip4Validation = void 0;
exports.serializeSignRequestSignerInputZip4ValidationValidationTypeField = serializeSignRequestSignerInputZip4ValidationValidationTypeField;
exports.deserializeSignRequestSignerInputZip4ValidationValidationTypeField = deserializeSignRequestSignerInputZip4ValidationValidationTypeField;
exports.serializeSignRequestSignerInputZip4Validation = serializeSignRequestSignerInputZip4Validation;
exports.deserializeSignRequestSignerInputZip4Validation = deserializeSignRequestSignerInputZip4Validation;
exports.serializeSignRequestSignerInputZip4ValidationInput = serializeSignRequestSignerInputZip4ValidationInput;
exports.deserializeSignRequestSignerInputZip4ValidationInput = deserializeSignRequestSignerInputZip4ValidationInput;
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
class SignRequestSignerInputZip4Validation {
    constructor(fields) {
        /**
         * Validates that the text input is a ZIP+4 code. */
        this.validationType = 'zip_4';
        if (fields.validationType !== undefined) {
            this.validationType = fields.validationType;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.SignRequestSignerInputZip4Validation = SignRequestSignerInputZip4Validation;
function serializeSignRequestSignerInputZip4ValidationValidationTypeField(val) {
    return val;
}
function deserializeSignRequestSignerInputZip4ValidationValidationTypeField(val) {
    if (val == 'zip_4') {
        return val;
    }
    if ((0, json_1.sdIsString)(val)) {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize SignRequestSignerInputZip4ValidationValidationTypeField",
    });
}
function serializeSignRequestSignerInputZip4Validation(val) {
    return {
        ['validation_type']: serializeSignRequestSignerInputZip4ValidationValidationTypeField(val.validationType),
    };
}
function deserializeSignRequestSignerInputZip4Validation(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SignRequestSignerInputZip4Validation"',
        });
    }
    if (val.validation_type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "validation_type" of type "SignRequestSignerInputZip4Validation" to be defined',
        });
    }
    const validationType = deserializeSignRequestSignerInputZip4ValidationValidationTypeField(val.validation_type);
    return {
        validationType: validationType,
    };
}
function serializeSignRequestSignerInputZip4ValidationInput(val) {
    return {
        ['validationType']: val.validationType == void 0
            ? val.validationType
            : serializeSignRequestSignerInputZip4ValidationValidationTypeField(val.validationType),
    };
}
function deserializeSignRequestSignerInputZip4ValidationInput(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SignRequestSignerInputZip4ValidationInput"',
        });
    }
    const validationType = val.validationType == void 0
        ? void 0
        : deserializeSignRequestSignerInputZip4ValidationValidationTypeField(val.validationType);
    return {
        validationType: validationType,
    };
}
//# sourceMappingURL=signRequestSignerInputZip4Validation.js.map