"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignRequestSignerInputEmailValidation = void 0;
exports.serializeSignRequestSignerInputEmailValidationValidationTypeField = serializeSignRequestSignerInputEmailValidationValidationTypeField;
exports.deserializeSignRequestSignerInputEmailValidationValidationTypeField = deserializeSignRequestSignerInputEmailValidationValidationTypeField;
exports.serializeSignRequestSignerInputEmailValidation = serializeSignRequestSignerInputEmailValidation;
exports.deserializeSignRequestSignerInputEmailValidation = deserializeSignRequestSignerInputEmailValidation;
exports.serializeSignRequestSignerInputEmailValidationInput = serializeSignRequestSignerInputEmailValidationInput;
exports.deserializeSignRequestSignerInputEmailValidationInput = deserializeSignRequestSignerInputEmailValidationInput;
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
class SignRequestSignerInputEmailValidation {
    /**
     * Validates that the text input is an email address. */
    validationType = 'email';
    rawData;
    constructor(fields) {
        if (fields.validationType !== undefined) {
            this.validationType = fields.validationType;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.SignRequestSignerInputEmailValidation = SignRequestSignerInputEmailValidation;
function serializeSignRequestSignerInputEmailValidationValidationTypeField(val) {
    return val;
}
function deserializeSignRequestSignerInputEmailValidationValidationTypeField(val) {
    if (val == 'email') {
        return val;
    }
    if ((0, json_1.sdIsString)(val)) {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize SignRequestSignerInputEmailValidationValidationTypeField",
    });
}
function serializeSignRequestSignerInputEmailValidation(val) {
    return {
        ['validation_type']: serializeSignRequestSignerInputEmailValidationValidationTypeField(val.validationType),
    };
}
function deserializeSignRequestSignerInputEmailValidation(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SignRequestSignerInputEmailValidation"',
        });
    }
    if (val.validation_type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "validation_type" of type "SignRequestSignerInputEmailValidation" to be defined',
        });
    }
    const validationType = deserializeSignRequestSignerInputEmailValidationValidationTypeField(val.validation_type);
    return {
        validationType: validationType,
    };
}
function serializeSignRequestSignerInputEmailValidationInput(val) {
    return {
        ['validationType']: val.validationType == void 0
            ? val.validationType
            : serializeSignRequestSignerInputEmailValidationValidationTypeField(val.validationType),
    };
}
function deserializeSignRequestSignerInputEmailValidationInput(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SignRequestSignerInputEmailValidationInput"',
        });
    }
    const validationType = val.validationType == void 0
        ? void 0
        : deserializeSignRequestSignerInputEmailValidationValidationTypeField(val.validationType);
    return {
        validationType: validationType,
    };
}
//# sourceMappingURL=signRequestSignerInputEmailValidation.js.map