"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnswerStateObject = exports.serializeSearchAnswer = exports.serializeQnaCollectionResponse = exports.serializeQna = exports.serializeIdentitySet = exports.serializeIdentity = exports.serializeBookmarkCollectionResponse = exports.serializeBookmark = exports.serializeAnswerVariant = exports.serializeAnswerKeyword = exports.serializeAcronymCollectionResponse = exports.serializeAcronym = exports.deserializeIntoSearchAnswer = exports.deserializeIntoQnaCollectionResponse = exports.deserializeIntoQna = exports.deserializeIntoIdentitySet = exports.deserializeIntoIdentity = exports.deserializeIntoBookmarkCollectionResponse = exports.deserializeIntoBookmark = exports.deserializeIntoAnswerVariant = exports.deserializeIntoAnswerKeyword = exports.deserializeIntoAcronymCollectionResponse = exports.deserializeIntoAcronym = exports.createSearchAnswerFromDiscriminatorValue = exports.createQnaFromDiscriminatorValue = exports.createQnaCollectionResponseFromDiscriminatorValue = exports.createIdentitySetFromDiscriminatorValue = exports.createIdentityFromDiscriminatorValue = exports.createBookmarkFromDiscriminatorValue = exports.createBookmarkCollectionResponseFromDiscriminatorValue = exports.createAnswerVariantFromDiscriminatorValue = exports.createAnswerKeywordFromDiscriminatorValue = exports.createAcronymFromDiscriminatorValue = exports.createAcronymCollectionResponseFromDiscriminatorValue = void 0;
/* tslint:disable */
/* eslint-disable */
// Generated by Microsoft Kiota
const __1 = require("../");
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a acronymCollectionResponse
 */
function createAcronymCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoAcronymCollectionResponse;
}
exports.createAcronymCollectionResponseFromDiscriminatorValue = createAcronymCollectionResponseFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a acronym
 */
function createAcronymFromDiscriminatorValue(parseNode) {
    return deserializeIntoAcronym;
}
exports.createAcronymFromDiscriminatorValue = createAcronymFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a answerKeyword
 */
function createAnswerKeywordFromDiscriminatorValue(parseNode) {
    return deserializeIntoAnswerKeyword;
}
exports.createAnswerKeywordFromDiscriminatorValue = createAnswerKeywordFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a answerVariant
 */
function createAnswerVariantFromDiscriminatorValue(parseNode) {
    return deserializeIntoAnswerVariant;
}
exports.createAnswerVariantFromDiscriminatorValue = createAnswerVariantFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a bookmarkCollectionResponse
 */
function createBookmarkCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoBookmarkCollectionResponse;
}
exports.createBookmarkCollectionResponseFromDiscriminatorValue = createBookmarkCollectionResponseFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a bookmark
 */
function createBookmarkFromDiscriminatorValue(parseNode) {
    return deserializeIntoBookmark;
}
exports.createBookmarkFromDiscriminatorValue = createBookmarkFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a identity
 */
function createIdentityFromDiscriminatorValue(parseNode) {
    return deserializeIntoIdentity;
}
exports.createIdentityFromDiscriminatorValue = createIdentityFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a identitySet
 */
function createIdentitySetFromDiscriminatorValue(parseNode) {
    return deserializeIntoIdentitySet;
}
exports.createIdentitySetFromDiscriminatorValue = createIdentitySetFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a qnaCollectionResponse
 */
function createQnaCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoQnaCollectionResponse;
}
exports.createQnaCollectionResponseFromDiscriminatorValue = createQnaCollectionResponseFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a qna
 */
function createQnaFromDiscriminatorValue(parseNode) {
    return deserializeIntoQna;
}
exports.createQnaFromDiscriminatorValue = createQnaFromDiscriminatorValue;
/**
 * Creates a new instance of the appropriate class based on discriminator value
 * @param parseNode The parse node to use to read the discriminator value and create the object
 * @returns a searchAnswer
 */
function createSearchAnswerFromDiscriminatorValue(parseNode) {
    if (!parseNode)
        throw new Error("parseNode cannot be undefined");
    const mappingValueNode = parseNode.getChildNode("@odata.type");
    if (mappingValueNode) {
        const mappingValue = mappingValueNode.getStringValue();
        if (mappingValue) {
            switch (mappingValue) {
                case "#microsoft.graph.search.acronym":
                    return deserializeIntoAcronym;
                case "#microsoft.graph.search.bookmark":
                    return deserializeIntoBookmark;
                case "#microsoft.graph.search.qna":
                    return deserializeIntoQna;
            }
        }
    }
    return deserializeIntoSearchAnswer;
}
exports.createSearchAnswerFromDiscriminatorValue = createSearchAnswerFromDiscriminatorValue;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoAcronym(acronym = {}) {
    return Object.assign(Object.assign({}, deserializeIntoSearchAnswer(acronym)), { "standsFor": n => { acronym.standsFor = n.getStringValue(); }, "state": n => { acronym.state = n.getEnumValue(exports.AnswerStateObject); } });
}
exports.deserializeIntoAcronym = deserializeIntoAcronym;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoAcronymCollectionResponse(acronymCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(acronymCollectionResponse)), { "value": n => { acronymCollectionResponse.value = n.getCollectionOfObjectValues(createAcronymFromDiscriminatorValue); } });
}
exports.deserializeIntoAcronymCollectionResponse = deserializeIntoAcronymCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoAnswerKeyword(answerKeyword = {}) {
    return {
        "backingStoreEnabled": n => { answerKeyword.backingStoreEnabled = true; },
        "keywords": n => { answerKeyword.keywords = n.getCollectionOfPrimitiveValues(); },
        "matchSimilarKeywords": n => { answerKeyword.matchSimilarKeywords = n.getBooleanValue(); },
        "@odata.type": n => { answerKeyword.odataType = n.getStringValue(); },
        "reservedKeywords": n => { answerKeyword.reservedKeywords = n.getCollectionOfPrimitiveValues(); },
    };
}
exports.deserializeIntoAnswerKeyword = deserializeIntoAnswerKeyword;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoAnswerVariant(answerVariant = {}) {
    return {
        "backingStoreEnabled": n => { answerVariant.backingStoreEnabled = true; },
        "description": n => { answerVariant.description = n.getStringValue(); },
        "displayName": n => { answerVariant.displayName = n.getStringValue(); },
        "languageTag": n => { answerVariant.languageTag = n.getStringValue(); },
        "@odata.type": n => { answerVariant.odataType = n.getStringValue(); },
        "platform": n => { answerVariant.platform = n.getEnumValue(__1.DevicePlatformTypeObject); },
        "webUrl": n => { answerVariant.webUrl = n.getStringValue(); },
    };
}
exports.deserializeIntoAnswerVariant = deserializeIntoAnswerVariant;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoBookmark(bookmark = {}) {
    return Object.assign(Object.assign({}, deserializeIntoSearchAnswer(bookmark)), { "availabilityEndDateTime": n => { bookmark.availabilityEndDateTime = n.getDateValue(); }, "availabilityStartDateTime": n => { bookmark.availabilityStartDateTime = n.getDateValue(); }, "categories": n => { bookmark.categories = n.getCollectionOfPrimitiveValues(); }, "groupIds": n => { bookmark.groupIds = n.getCollectionOfPrimitiveValues(); }, "isSuggested": n => { bookmark.isSuggested = n.getBooleanValue(); }, "keywords": n => { bookmark.keywords = n.getObjectValue(createAnswerKeywordFromDiscriminatorValue); }, "languageTags": n => { bookmark.languageTags = n.getCollectionOfPrimitiveValues(); }, "platforms": n => { bookmark.platforms = n.getCollectionOfEnumValues(__1.DevicePlatformTypeObject); }, "powerAppIds": n => { bookmark.powerAppIds = n.getCollectionOfPrimitiveValues(); }, "state": n => { bookmark.state = n.getEnumValue(exports.AnswerStateObject); }, "targetedVariations": n => { bookmark.targetedVariations = n.getCollectionOfObjectValues(createAnswerVariantFromDiscriminatorValue); } });
}
exports.deserializeIntoBookmark = deserializeIntoBookmark;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoBookmarkCollectionResponse(bookmarkCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(bookmarkCollectionResponse)), { "value": n => { bookmarkCollectionResponse.value = n.getCollectionOfObjectValues(createBookmarkFromDiscriminatorValue); } });
}
exports.deserializeIntoBookmarkCollectionResponse = deserializeIntoBookmarkCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoIdentity(identity = {}) {
    return {
        "backingStoreEnabled": n => { identity.backingStoreEnabled = true; },
        "displayName": n => { identity.displayName = n.getStringValue(); },
        "id": n => { identity.id = n.getStringValue(); },
        "@odata.type": n => { identity.odataType = n.getStringValue(); },
    };
}
exports.deserializeIntoIdentity = deserializeIntoIdentity;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoIdentitySet(identitySet = {}) {
    return {
        "application": n => { identitySet.application = n.getObjectValue(createIdentityFromDiscriminatorValue); },
        "backingStoreEnabled": n => { identitySet.backingStoreEnabled = true; },
        "device": n => { identitySet.device = n.getObjectValue(createIdentityFromDiscriminatorValue); },
        "@odata.type": n => { identitySet.odataType = n.getStringValue(); },
        "user": n => { identitySet.user = n.getObjectValue(createIdentityFromDiscriminatorValue); },
    };
}
exports.deserializeIntoIdentitySet = deserializeIntoIdentitySet;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoQna(qna = {}) {
    return Object.assign(Object.assign({}, deserializeIntoSearchAnswer(qna)), { "availabilityEndDateTime": n => { qna.availabilityEndDateTime = n.getDateValue(); }, "availabilityStartDateTime": n => { qna.availabilityStartDateTime = n.getDateValue(); }, "groupIds": n => { qna.groupIds = n.getCollectionOfPrimitiveValues(); }, "isSuggested": n => { qna.isSuggested = n.getBooleanValue(); }, "keywords": n => { qna.keywords = n.getObjectValue(createAnswerKeywordFromDiscriminatorValue); }, "languageTags": n => { qna.languageTags = n.getCollectionOfPrimitiveValues(); }, "platforms": n => { qna.platforms = n.getCollectionOfEnumValues(__1.DevicePlatformTypeObject); }, "state": n => { qna.state = n.getEnumValue(exports.AnswerStateObject); }, "targetedVariations": n => { qna.targetedVariations = n.getCollectionOfObjectValues(createAnswerVariantFromDiscriminatorValue); } });
}
exports.deserializeIntoQna = deserializeIntoQna;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoQnaCollectionResponse(qnaCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(qnaCollectionResponse)), { "value": n => { qnaCollectionResponse.value = n.getCollectionOfObjectValues(createQnaFromDiscriminatorValue); } });
}
exports.deserializeIntoQnaCollectionResponse = deserializeIntoQnaCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoSearchAnswer(searchAnswer = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(searchAnswer)), { "description": n => { searchAnswer.description = n.getStringValue(); }, "displayName": n => { searchAnswer.displayName = n.getStringValue(); }, "lastModifiedBy": n => { searchAnswer.lastModifiedBy = n.getObjectValue(createIdentitySetFromDiscriminatorValue); }, "lastModifiedDateTime": n => { searchAnswer.lastModifiedDateTime = n.getDateValue(); }, "webUrl": n => { searchAnswer.webUrl = n.getStringValue(); } });
}
exports.deserializeIntoSearchAnswer = deserializeIntoSearchAnswer;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeAcronym(writer, acronym = {}) {
    serializeSearchAnswer(writer, acronym);
    writer.writeStringValue("standsFor", acronym.standsFor);
    writer.writeEnumValue("state", acronym.state);
}
exports.serializeAcronym = serializeAcronym;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeAcronymCollectionResponse(writer, acronymCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, acronymCollectionResponse);
    writer.writeCollectionOfObjectValues("value", acronymCollectionResponse.value, serializeAcronym);
}
exports.serializeAcronymCollectionResponse = serializeAcronymCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeAnswerKeyword(writer, answerKeyword = {}) {
    writer.writeCollectionOfPrimitiveValues("keywords", answerKeyword.keywords);
    writer.writeBooleanValue("matchSimilarKeywords", answerKeyword.matchSimilarKeywords);
    writer.writeStringValue("@odata.type", answerKeyword.odataType);
    writer.writeCollectionOfPrimitiveValues("reservedKeywords", answerKeyword.reservedKeywords);
    writer.writeAdditionalData(answerKeyword.additionalData);
}
exports.serializeAnswerKeyword = serializeAnswerKeyword;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeAnswerVariant(writer, answerVariant = {}) {
    writer.writeStringValue("description", answerVariant.description);
    writer.writeStringValue("displayName", answerVariant.displayName);
    writer.writeStringValue("languageTag", answerVariant.languageTag);
    writer.writeStringValue("@odata.type", answerVariant.odataType);
    writer.writeEnumValue("platform", answerVariant.platform);
    writer.writeStringValue("webUrl", answerVariant.webUrl);
    writer.writeAdditionalData(answerVariant.additionalData);
}
exports.serializeAnswerVariant = serializeAnswerVariant;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeBookmark(writer, bookmark = {}) {
    serializeSearchAnswer(writer, bookmark);
    writer.writeDateValue("availabilityEndDateTime", bookmark.availabilityEndDateTime);
    writer.writeDateValue("availabilityStartDateTime", bookmark.availabilityStartDateTime);
    writer.writeCollectionOfPrimitiveValues("categories", bookmark.categories);
    writer.writeCollectionOfPrimitiveValues("groupIds", bookmark.groupIds);
    writer.writeBooleanValue("isSuggested", bookmark.isSuggested);
    writer.writeObjectValue("keywords", bookmark.keywords, serializeAnswerKeyword);
    writer.writeCollectionOfPrimitiveValues("languageTags", bookmark.languageTags);
    if (bookmark.platforms)
        writer.writeEnumValue("platforms", ...bookmark.platforms);
    writer.writeCollectionOfPrimitiveValues("powerAppIds", bookmark.powerAppIds);
    writer.writeEnumValue("state", bookmark.state);
    writer.writeCollectionOfObjectValues("targetedVariations", bookmark.targetedVariations, serializeAnswerVariant);
}
exports.serializeBookmark = serializeBookmark;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeBookmarkCollectionResponse(writer, bookmarkCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, bookmarkCollectionResponse);
    writer.writeCollectionOfObjectValues("value", bookmarkCollectionResponse.value, serializeBookmark);
}
exports.serializeBookmarkCollectionResponse = serializeBookmarkCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeIdentity(writer, identity = {}) {
    writer.writeStringValue("displayName", identity.displayName);
    writer.writeStringValue("id", identity.id);
    writer.writeStringValue("@odata.type", identity.odataType);
    writer.writeAdditionalData(identity.additionalData);
}
exports.serializeIdentity = serializeIdentity;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeIdentitySet(writer, identitySet = {}) {
    writer.writeObjectValue("application", identitySet.application, serializeIdentity);
    writer.writeObjectValue("device", identitySet.device, serializeIdentity);
    writer.writeStringValue("@odata.type", identitySet.odataType);
    writer.writeObjectValue("user", identitySet.user, serializeIdentity);
    writer.writeAdditionalData(identitySet.additionalData);
}
exports.serializeIdentitySet = serializeIdentitySet;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeQna(writer, qna = {}) {
    serializeSearchAnswer(writer, qna);
    writer.writeDateValue("availabilityEndDateTime", qna.availabilityEndDateTime);
    writer.writeDateValue("availabilityStartDateTime", qna.availabilityStartDateTime);
    writer.writeCollectionOfPrimitiveValues("groupIds", qna.groupIds);
    writer.writeBooleanValue("isSuggested", qna.isSuggested);
    writer.writeObjectValue("keywords", qna.keywords, serializeAnswerKeyword);
    writer.writeCollectionOfPrimitiveValues("languageTags", qna.languageTags);
    if (qna.platforms)
        writer.writeEnumValue("platforms", ...qna.platforms);
    writer.writeEnumValue("state", qna.state);
    writer.writeCollectionOfObjectValues("targetedVariations", qna.targetedVariations, serializeAnswerVariant);
}
exports.serializeQna = serializeQna;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeQnaCollectionResponse(writer, qnaCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, qnaCollectionResponse);
    writer.writeCollectionOfObjectValues("value", qnaCollectionResponse.value, serializeQna);
}
exports.serializeQnaCollectionResponse = serializeQnaCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeSearchAnswer(writer, searchAnswer = {}) {
    (0, __1.serializeEntity)(writer, searchAnswer);
    writer.writeStringValue("description", searchAnswer.description);
    writer.writeStringValue("displayName", searchAnswer.displayName);
    writer.writeObjectValue("lastModifiedBy", searchAnswer.lastModifiedBy, serializeIdentitySet);
    writer.writeDateValue("lastModifiedDateTime", searchAnswer.lastModifiedDateTime);
    writer.writeStringValue("webUrl", searchAnswer.webUrl);
}
exports.serializeSearchAnswer = serializeSearchAnswer;
exports.AnswerStateObject = {
    Published: "published",
    Draft: "draft",
    Excluded: "excluded",
    UnknownFutureValue: "unknownFutureValue",
};
/* tslint:enable */
/* eslint-enable */
