/**
 * 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 {ErrorDetails}
 */
// @ts-ignore
export function createErrorDetailsFromDiscriminatorValue(parseNode) {
    return deserializeIntoErrorDetails;
}
/**
 * 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 {InnerError}
 */
// @ts-ignore
export function createInnerErrorFromDiscriminatorValue(parseNode) {
    return deserializeIntoInnerError;
}
/**
 * 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 {MainError}
 */
// @ts-ignore
export function createMainErrorFromDiscriminatorValue(parseNode) {
    return deserializeIntoMainError;
}
/**
 * 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 {ODataError}
 */
// @ts-ignore
export function createODataErrorFromDiscriminatorValue(parseNode) {
    return deserializeIntoODataError;
}
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
// @ts-ignore
export function deserializeIntoErrorDetails(errorDetails = {}) {
    return {
        "backingStoreEnabled": n => { errorDetails.backingStoreEnabled = true; },
        "code": n => { errorDetails.code = n.getStringValue(); },
        "message": n => { errorDetails.message = n.getStringValue(); },
        "target": n => { errorDetails.target = n.getStringValue(); },
    };
}
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
// @ts-ignore
export function deserializeIntoInnerError(innerError = {}) {
    return {
        "backingStoreEnabled": n => { innerError.backingStoreEnabled = true; },
        "client-request-id": n => { innerError.clientRequestId = n.getStringValue(); },
        "date": n => { innerError.date = n.getDateValue(); },
        "@odata.type": n => { innerError.odataType = n.getStringValue(); },
        "request-id": n => { innerError.requestId = n.getStringValue(); },
    };
}
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
// @ts-ignore
export function deserializeIntoMainError(mainError = {}) {
    return {
        "backingStoreEnabled": n => { mainError.backingStoreEnabled = true; },
        "code": n => { mainError.code = n.getStringValue(); },
        "details": n => { mainError.details = n.getCollectionOfObjectValues(createErrorDetailsFromDiscriminatorValue); },
        "innerError": n => { mainError.innerError = n.getObjectValue(createInnerErrorFromDiscriminatorValue); },
        "message": n => { mainError.message = n.getStringValue(); },
        "target": n => { mainError.target = n.getStringValue(); },
    };
}
/**
 * The deserialization information for the current model
 * @returns {Record<string, (node: ParseNode) => void>}
 */
// @ts-ignore
export function deserializeIntoODataError(oDataError = {}) {
    return {
        "backingStoreEnabled": n => { oDataError.backingStoreEnabled = true; },
        "error": n => { var _a, _b; oDataError.errorEscaped = n.getObjectValue(createMainErrorFromDiscriminatorValue); oDataError.message = (_b = (_a = oDataError.errorEscaped) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : ""; },
    };
}
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
// @ts-ignore
export function serializeErrorDetails(writer, errorDetails = {}) {
    if (errorDetails) {
        writer.writeStringValue("code", errorDetails.code);
        writer.writeStringValue("message", errorDetails.message);
        writer.writeStringValue("target", errorDetails.target);
        writer.writeAdditionalData(errorDetails.additionalData);
    }
}
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
// @ts-ignore
export function serializeInnerError(writer, innerError = {}) {
    if (innerError) {
        writer.writeStringValue("client-request-id", innerError.clientRequestId);
        writer.writeDateValue("date", innerError.date);
        writer.writeStringValue("@odata.type", innerError.odataType);
        writer.writeStringValue("request-id", innerError.requestId);
        writer.writeAdditionalData(innerError.additionalData);
    }
}
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
// @ts-ignore
export function serializeMainError(writer, mainError = {}) {
    if (mainError) {
        writer.writeStringValue("code", mainError.code);
        writer.writeCollectionOfObjectValues("details", mainError.details, serializeErrorDetails);
        writer.writeObjectValue("innerError", mainError.innerError, serializeInnerError);
        writer.writeStringValue("message", mainError.message);
        writer.writeStringValue("target", mainError.target);
        writer.writeAdditionalData(mainError.additionalData);
    }
}
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
// @ts-ignore
export function serializeODataError(writer, oDataError = {}) {
    if (oDataError) {
        writer.writeObjectValue("error", oDataError.errorEscaped, serializeMainError);
        writer.writeAdditionalData(oDataError.additionalData);
    }
}
/* tslint:enable */
/* eslint-enable */
//# sourceMappingURL=index.js.map