"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TermGroupScopeObject = exports.RelationTypeObject = exports.serializeTermCollectionResponse = exports.serializeTerm = exports.serializeStore = exports.serializeSetCollectionResponse = exports.serializeSet = exports.serializeRelationCollectionResponse = exports.serializeRelation = exports.serializeLocalizedName = exports.serializeLocalizedLabel = exports.serializeLocalizedDescription = exports.serializeGroupCollectionResponse = exports.serializeGroup = exports.deserializeIntoTermCollectionResponse = exports.deserializeIntoTerm = exports.deserializeIntoStore = exports.deserializeIntoSetCollectionResponse = exports.deserializeIntoSet = exports.deserializeIntoRelationCollectionResponse = exports.deserializeIntoRelation = exports.deserializeIntoLocalizedName = exports.deserializeIntoLocalizedLabel = exports.deserializeIntoLocalizedDescription = exports.deserializeIntoGroupCollectionResponse = exports.deserializeIntoGroup = exports.createTermFromDiscriminatorValue = exports.createTermCollectionResponseFromDiscriminatorValue = exports.createStoreFromDiscriminatorValue = exports.createSetFromDiscriminatorValue = exports.createSetCollectionResponseFromDiscriminatorValue = exports.createRelationFromDiscriminatorValue = exports.createRelationCollectionResponseFromDiscriminatorValue = exports.createLocalizedNameFromDiscriminatorValue = exports.createLocalizedLabelFromDiscriminatorValue = exports.createLocalizedDescriptionFromDiscriminatorValue = exports.createGroupFromDiscriminatorValue = exports.createGroupCollectionResponseFromDiscriminatorValue = void 0;
/* tslint:disable */
/* eslint-disable */
// Generated by Microsoft Kiota
// @ts-ignore
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 {GroupCollectionResponse}
 */
function createGroupCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoGroupCollectionResponse;
}
exports.createGroupCollectionResponseFromDiscriminatorValue = createGroupCollectionResponseFromDiscriminatorValue;
/**
 * 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 {Group}
 */
function createGroupFromDiscriminatorValue(parseNode) {
    return deserializeIntoGroup;
}
exports.createGroupFromDiscriminatorValue = createGroupFromDiscriminatorValue;
/**
 * 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 {LocalizedDescription}
 */
function createLocalizedDescriptionFromDiscriminatorValue(parseNode) {
    return deserializeIntoLocalizedDescription;
}
exports.createLocalizedDescriptionFromDiscriminatorValue = createLocalizedDescriptionFromDiscriminatorValue;
/**
 * 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 {LocalizedLabel}
 */
function createLocalizedLabelFromDiscriminatorValue(parseNode) {
    return deserializeIntoLocalizedLabel;
}
exports.createLocalizedLabelFromDiscriminatorValue = createLocalizedLabelFromDiscriminatorValue;
/**
 * 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 {LocalizedName}
 */
function createLocalizedNameFromDiscriminatorValue(parseNode) {
    return deserializeIntoLocalizedName;
}
exports.createLocalizedNameFromDiscriminatorValue = createLocalizedNameFromDiscriminatorValue;
/**
 * 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 {RelationCollectionResponse}
 */
function createRelationCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoRelationCollectionResponse;
}
exports.createRelationCollectionResponseFromDiscriminatorValue = createRelationCollectionResponseFromDiscriminatorValue;
/**
 * 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 {Relation}
 */
function createRelationFromDiscriminatorValue(parseNode) {
    return deserializeIntoRelation;
}
exports.createRelationFromDiscriminatorValue = createRelationFromDiscriminatorValue;
/**
 * 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 {SetCollectionResponse}
 */
function createSetCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoSetCollectionResponse;
}
exports.createSetCollectionResponseFromDiscriminatorValue = createSetCollectionResponseFromDiscriminatorValue;
/**
 * 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 {Set}
 */
function createSetFromDiscriminatorValue(parseNode) {
    return deserializeIntoSet;
}
exports.createSetFromDiscriminatorValue = createSetFromDiscriminatorValue;
/**
 * 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 {Store}
 */
function createStoreFromDiscriminatorValue(parseNode) {
    return deserializeIntoStore;
}
exports.createStoreFromDiscriminatorValue = createStoreFromDiscriminatorValue;
/**
 * 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 {TermCollectionResponse}
 */
function createTermCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoTermCollectionResponse;
}
exports.createTermCollectionResponseFromDiscriminatorValue = createTermCollectionResponseFromDiscriminatorValue;
/**
 * 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 {Term}
 */
function createTermFromDiscriminatorValue(parseNode) {
    return deserializeIntoTerm;
}
exports.createTermFromDiscriminatorValue = createTermFromDiscriminatorValue;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoGroup(group = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(group)), { "createdDateTime": n => { group.createdDateTime = n.getDateValue(); }, "description": n => { group.description = n.getStringValue(); }, "displayName": n => { group.displayName = n.getStringValue(); }, "parentSiteId": n => { group.parentSiteId = n.getStringValue(); }, "scope": n => { group.scope = n.getEnumValue(exports.TermGroupScopeObject); }, "sets": n => { group.sets = n.getCollectionOfObjectValues(createSetFromDiscriminatorValue); } });
}
exports.deserializeIntoGroup = deserializeIntoGroup;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoGroupCollectionResponse(groupCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(groupCollectionResponse)), { "value": n => { groupCollectionResponse.value = n.getCollectionOfObjectValues(createGroupFromDiscriminatorValue); } });
}
exports.deserializeIntoGroupCollectionResponse = deserializeIntoGroupCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoLocalizedDescription(localizedDescription = {}) {
    return {
        "backingStoreEnabled": n => { localizedDescription.backingStoreEnabled = true; },
        "description": n => { localizedDescription.description = n.getStringValue(); },
        "languageTag": n => { localizedDescription.languageTag = n.getStringValue(); },
        "@odata.type": n => { localizedDescription.odataType = n.getStringValue(); },
    };
}
exports.deserializeIntoLocalizedDescription = deserializeIntoLocalizedDescription;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoLocalizedLabel(localizedLabel = {}) {
    return {
        "backingStoreEnabled": n => { localizedLabel.backingStoreEnabled = true; },
        "isDefault": n => { localizedLabel.isDefault = n.getBooleanValue(); },
        "languageTag": n => { localizedLabel.languageTag = n.getStringValue(); },
        "name": n => { localizedLabel.name = n.getStringValue(); },
        "@odata.type": n => { localizedLabel.odataType = n.getStringValue(); },
    };
}
exports.deserializeIntoLocalizedLabel = deserializeIntoLocalizedLabel;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoLocalizedName(localizedName = {}) {
    return {
        "backingStoreEnabled": n => { localizedName.backingStoreEnabled = true; },
        "languageTag": n => { localizedName.languageTag = n.getStringValue(); },
        "name": n => { localizedName.name = n.getStringValue(); },
        "@odata.type": n => { localizedName.odataType = n.getStringValue(); },
    };
}
exports.deserializeIntoLocalizedName = deserializeIntoLocalizedName;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoRelation(relation = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(relation)), { "fromTerm": n => { relation.fromTerm = n.getObjectValue(createTermFromDiscriminatorValue); }, "relationship": n => { relation.relationship = n.getEnumValue(exports.RelationTypeObject); }, "set": n => { relation.set = n.getObjectValue(createSetFromDiscriminatorValue); }, "toTerm": n => { relation.toTerm = n.getObjectValue(createTermFromDiscriminatorValue); } });
}
exports.deserializeIntoRelation = deserializeIntoRelation;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoRelationCollectionResponse(relationCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(relationCollectionResponse)), { "value": n => { relationCollectionResponse.value = n.getCollectionOfObjectValues(createRelationFromDiscriminatorValue); } });
}
exports.deserializeIntoRelationCollectionResponse = deserializeIntoRelationCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoSet(set = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(set)), { "children": n => { set.children = n.getCollectionOfObjectValues(createTermFromDiscriminatorValue); }, "createdDateTime": n => { set.createdDateTime = n.getDateValue(); }, "description": n => { set.description = n.getStringValue(); }, "localizedNames": n => { set.localizedNames = n.getCollectionOfObjectValues(createLocalizedNameFromDiscriminatorValue); }, "parentGroup": n => { set.parentGroup = n.getObjectValue(createGroupFromDiscriminatorValue); }, "properties": n => { set.properties = n.getCollectionOfObjectValues(__1.createKeyValueFromDiscriminatorValue); }, "relations": n => { set.relations = n.getCollectionOfObjectValues(createRelationFromDiscriminatorValue); }, "terms": n => { set.terms = n.getCollectionOfObjectValues(createTermFromDiscriminatorValue); } });
}
exports.deserializeIntoSet = deserializeIntoSet;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoSetCollectionResponse(setCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(setCollectionResponse)), { "value": n => { setCollectionResponse.value = n.getCollectionOfObjectValues(createSetFromDiscriminatorValue); } });
}
exports.deserializeIntoSetCollectionResponse = deserializeIntoSetCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoStore(store = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(store)), { "defaultLanguageTag": n => { store.defaultLanguageTag = n.getStringValue(); }, "groups": n => { store.groups = n.getCollectionOfObjectValues(createGroupFromDiscriminatorValue); }, "languageTags": n => { store.languageTags = n.getCollectionOfPrimitiveValues(); }, "sets": n => { store.sets = n.getCollectionOfObjectValues(createSetFromDiscriminatorValue); } });
}
exports.deserializeIntoStore = deserializeIntoStore;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoTerm(term = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(term)), { "children": n => { term.children = n.getCollectionOfObjectValues(createTermFromDiscriminatorValue); }, "createdDateTime": n => { term.createdDateTime = n.getDateValue(); }, "descriptions": n => { term.descriptions = n.getCollectionOfObjectValues(createLocalizedDescriptionFromDiscriminatorValue); }, "labels": n => { term.labels = n.getCollectionOfObjectValues(createLocalizedLabelFromDiscriminatorValue); }, "lastModifiedDateTime": n => { term.lastModifiedDateTime = n.getDateValue(); }, "properties": n => { term.properties = n.getCollectionOfObjectValues(__1.createKeyValueFromDiscriminatorValue); }, "relations": n => { term.relations = n.getCollectionOfObjectValues(createRelationFromDiscriminatorValue); }, "set": n => { term.set = n.getObjectValue(createSetFromDiscriminatorValue); } });
}
exports.deserializeIntoTerm = deserializeIntoTerm;
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
function deserializeIntoTermCollectionResponse(termCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(termCollectionResponse)), { "value": n => { termCollectionResponse.value = n.getCollectionOfObjectValues(createTermFromDiscriminatorValue); } });
}
exports.deserializeIntoTermCollectionResponse = deserializeIntoTermCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeGroup(writer, group = {}) {
    (0, __1.serializeEntity)(writer, group);
    writer.writeDateValue("createdDateTime", group.createdDateTime);
    writer.writeStringValue("description", group.description);
    writer.writeStringValue("displayName", group.displayName);
    writer.writeStringValue("parentSiteId", group.parentSiteId);
    writer.writeEnumValue("scope", group.scope);
    writer.writeCollectionOfObjectValues("sets", group.sets, serializeSet);
}
exports.serializeGroup = serializeGroup;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeGroupCollectionResponse(writer, groupCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, groupCollectionResponse);
    writer.writeCollectionOfObjectValues("value", groupCollectionResponse.value, serializeGroup);
}
exports.serializeGroupCollectionResponse = serializeGroupCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeLocalizedDescription(writer, localizedDescription = {}) {
    writer.writeStringValue("description", localizedDescription.description);
    writer.writeStringValue("languageTag", localizedDescription.languageTag);
    writer.writeStringValue("@odata.type", localizedDescription.odataType);
    writer.writeAdditionalData(localizedDescription.additionalData);
}
exports.serializeLocalizedDescription = serializeLocalizedDescription;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeLocalizedLabel(writer, localizedLabel = {}) {
    writer.writeBooleanValue("isDefault", localizedLabel.isDefault);
    writer.writeStringValue("languageTag", localizedLabel.languageTag);
    writer.writeStringValue("name", localizedLabel.name);
    writer.writeStringValue("@odata.type", localizedLabel.odataType);
    writer.writeAdditionalData(localizedLabel.additionalData);
}
exports.serializeLocalizedLabel = serializeLocalizedLabel;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeLocalizedName(writer, localizedName = {}) {
    writer.writeStringValue("languageTag", localizedName.languageTag);
    writer.writeStringValue("name", localizedName.name);
    writer.writeStringValue("@odata.type", localizedName.odataType);
    writer.writeAdditionalData(localizedName.additionalData);
}
exports.serializeLocalizedName = serializeLocalizedName;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeRelation(writer, relation = {}) {
    (0, __1.serializeEntity)(writer, relation);
    writer.writeObjectValue("fromTerm", relation.fromTerm, serializeTerm);
    writer.writeEnumValue("relationship", relation.relationship);
    writer.writeObjectValue("set", relation.set, serializeSet);
    writer.writeObjectValue("toTerm", relation.toTerm, serializeTerm);
}
exports.serializeRelation = serializeRelation;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeRelationCollectionResponse(writer, relationCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, relationCollectionResponse);
    writer.writeCollectionOfObjectValues("value", relationCollectionResponse.value, serializeRelation);
}
exports.serializeRelationCollectionResponse = serializeRelationCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeSet(writer, set = {}) {
    (0, __1.serializeEntity)(writer, set);
    writer.writeCollectionOfObjectValues("children", set.children, serializeTerm);
    writer.writeDateValue("createdDateTime", set.createdDateTime);
    writer.writeStringValue("description", set.description);
    writer.writeCollectionOfObjectValues("localizedNames", set.localizedNames, serializeLocalizedName);
    writer.writeObjectValue("parentGroup", set.parentGroup, serializeGroup);
    writer.writeCollectionOfObjectValues("properties", set.properties, __1.serializeKeyValue);
    writer.writeCollectionOfObjectValues("relations", set.relations, serializeRelation);
    writer.writeCollectionOfObjectValues("terms", set.terms, serializeTerm);
}
exports.serializeSet = serializeSet;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeSetCollectionResponse(writer, setCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, setCollectionResponse);
    writer.writeCollectionOfObjectValues("value", setCollectionResponse.value, serializeSet);
}
exports.serializeSetCollectionResponse = serializeSetCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeStore(writer, store = {}) {
    (0, __1.serializeEntity)(writer, store);
    writer.writeStringValue("defaultLanguageTag", store.defaultLanguageTag);
    writer.writeCollectionOfObjectValues("groups", store.groups, serializeGroup);
    writer.writeCollectionOfPrimitiveValues("languageTags", store.languageTags);
    writer.writeCollectionOfObjectValues("sets", store.sets, serializeSet);
}
exports.serializeStore = serializeStore;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeTerm(writer, term = {}) {
    (0, __1.serializeEntity)(writer, term);
    writer.writeCollectionOfObjectValues("children", term.children, serializeTerm);
    writer.writeDateValue("createdDateTime", term.createdDateTime);
    writer.writeCollectionOfObjectValues("descriptions", term.descriptions, serializeLocalizedDescription);
    writer.writeCollectionOfObjectValues("labels", term.labels, serializeLocalizedLabel);
    writer.writeDateValue("lastModifiedDateTime", term.lastModifiedDateTime);
    writer.writeCollectionOfObjectValues("properties", term.properties, __1.serializeKeyValue);
    writer.writeCollectionOfObjectValues("relations", term.relations, serializeRelation);
    writer.writeObjectValue("set", term.set, serializeSet);
}
exports.serializeTerm = serializeTerm;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeTermCollectionResponse(writer, termCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, termCollectionResponse);
    writer.writeCollectionOfObjectValues("value", termCollectionResponse.value, serializeTerm);
}
exports.serializeTermCollectionResponse = serializeTermCollectionResponse;
exports.RelationTypeObject = {
    Pin: "pin",
    Reuse: "reuse",
};
exports.TermGroupScopeObject = {
    Global: "global",
    System: "system",
    SiteCollection: "siteCollection",
};
/* tslint:enable */
/* eslint-enable */
