"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BillingPeriodObject = exports.AttributeSetObject = exports.serializeUnbilledUsage = exports.serializeRunningOperation = exports.serializeOperationCollectionResponse = exports.serializeOperation = exports.serializeManifestCollectionResponse = exports.serializeManifest = exports.serializeFailedOperation = exports.serializeExportSuccessOperation = exports.serializeBlob = exports.serializeBilling = exports.serializeBilledUsage = exports.serializeAzureUsage = exports.deserializeIntoUnbilledUsage = exports.deserializeIntoRunningOperation = exports.deserializeIntoOperationCollectionResponse = exports.deserializeIntoOperation = exports.deserializeIntoManifestCollectionResponse = exports.deserializeIntoManifest = exports.deserializeIntoFailedOperation = exports.deserializeIntoExportSuccessOperation = exports.deserializeIntoBlob = exports.deserializeIntoBilling = exports.deserializeIntoBilledUsage = exports.deserializeIntoAzureUsage = exports.createUnbilledUsageFromDiscriminatorValue = exports.createRunningOperationFromDiscriminatorValue = exports.createOperationFromDiscriminatorValue = exports.createOperationCollectionResponseFromDiscriminatorValue = exports.createManifestFromDiscriminatorValue = exports.createManifestCollectionResponseFromDiscriminatorValue = exports.createFailedOperationFromDiscriminatorValue = exports.createExportSuccessOperationFromDiscriminatorValue = exports.createBlobFromDiscriminatorValue = exports.createBillingFromDiscriminatorValue = exports.createBilledUsageFromDiscriminatorValue = exports.createAzureUsageFromDiscriminatorValue = 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 azureUsage
 */
function createAzureUsageFromDiscriminatorValue(parseNode) {
    return deserializeIntoAzureUsage;
}
exports.createAzureUsageFromDiscriminatorValue = createAzureUsageFromDiscriminatorValue;
/**
 * 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 billedUsage
 */
function createBilledUsageFromDiscriminatorValue(parseNode) {
    return deserializeIntoBilledUsage;
}
exports.createBilledUsageFromDiscriminatorValue = createBilledUsageFromDiscriminatorValue;
/**
 * 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 billing
 */
function createBillingFromDiscriminatorValue(parseNode) {
    return deserializeIntoBilling;
}
exports.createBillingFromDiscriminatorValue = createBillingFromDiscriminatorValue;
/**
 * 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 blob
 */
function createBlobFromDiscriminatorValue(parseNode) {
    return deserializeIntoBlob;
}
exports.createBlobFromDiscriminatorValue = createBlobFromDiscriminatorValue;
/**
 * 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 exportSuccessOperation
 */
function createExportSuccessOperationFromDiscriminatorValue(parseNode) {
    return deserializeIntoExportSuccessOperation;
}
exports.createExportSuccessOperationFromDiscriminatorValue = createExportSuccessOperationFromDiscriminatorValue;
/**
 * 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 failedOperation
 */
function createFailedOperationFromDiscriminatorValue(parseNode) {
    return deserializeIntoFailedOperation;
}
exports.createFailedOperationFromDiscriminatorValue = createFailedOperationFromDiscriminatorValue;
/**
 * 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 manifestCollectionResponse
 */
function createManifestCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoManifestCollectionResponse;
}
exports.createManifestCollectionResponseFromDiscriminatorValue = createManifestCollectionResponseFromDiscriminatorValue;
/**
 * 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 manifest
 */
function createManifestFromDiscriminatorValue(parseNode) {
    return deserializeIntoManifest;
}
exports.createManifestFromDiscriminatorValue = createManifestFromDiscriminatorValue;
/**
 * 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 operationCollectionResponse
 */
function createOperationCollectionResponseFromDiscriminatorValue(parseNode) {
    return deserializeIntoOperationCollectionResponse;
}
exports.createOperationCollectionResponseFromDiscriminatorValue = createOperationCollectionResponseFromDiscriminatorValue;
/**
 * 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 operation
 */
function createOperationFromDiscriminatorValue(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.partners.billing.exportSuccessOperation":
                    return deserializeIntoExportSuccessOperation;
                case "#microsoft.graph.partners.billing.failedOperation":
                    return deserializeIntoFailedOperation;
                case "#microsoft.graph.partners.billing.runningOperation":
                    return deserializeIntoRunningOperation;
            }
        }
    }
    return deserializeIntoOperation;
}
exports.createOperationFromDiscriminatorValue = createOperationFromDiscriminatorValue;
/**
 * 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 runningOperation
 */
function createRunningOperationFromDiscriminatorValue(parseNode) {
    return deserializeIntoRunningOperation;
}
exports.createRunningOperationFromDiscriminatorValue = createRunningOperationFromDiscriminatorValue;
/**
 * 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 unbilledUsage
 */
function createUnbilledUsageFromDiscriminatorValue(parseNode) {
    return deserializeIntoUnbilledUsage;
}
exports.createUnbilledUsageFromDiscriminatorValue = createUnbilledUsageFromDiscriminatorValue;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoAzureUsage(azureUsage = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(azureUsage)), { "billed": n => { azureUsage.billed = n.getObjectValue(createBilledUsageFromDiscriminatorValue); }, "unbilled": n => { azureUsage.unbilled = n.getObjectValue(createUnbilledUsageFromDiscriminatorValue); } });
}
exports.deserializeIntoAzureUsage = deserializeIntoAzureUsage;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoBilledUsage(billedUsage = {}) {
    return Object.assign({}, (0, __1.deserializeIntoEntity)(billedUsage));
}
exports.deserializeIntoBilledUsage = deserializeIntoBilledUsage;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoBilling(billing = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(billing)), { "manifests": n => { billing.manifests = n.getCollectionOfObjectValues(createManifestFromDiscriminatorValue); }, "operations": n => { billing.operations = n.getCollectionOfObjectValues(createOperationFromDiscriminatorValue); }, "usage": n => { billing.usage = n.getObjectValue(createAzureUsageFromDiscriminatorValue); } });
}
exports.deserializeIntoBilling = deserializeIntoBilling;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoBlob(blob = {}) {
    return {
        "backingStoreEnabled": n => { blob.backingStoreEnabled = true; },
        "name": n => { blob.name = n.getStringValue(); },
        "@odata.type": n => { blob.odataType = n.getStringValue(); },
        "partitionValue": n => { blob.partitionValue = n.getStringValue(); },
    };
}
exports.deserializeIntoBlob = deserializeIntoBlob;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoExportSuccessOperation(exportSuccessOperation = {}) {
    return Object.assign(Object.assign({}, deserializeIntoOperation(exportSuccessOperation)), { "resourceLocation": n => { exportSuccessOperation.resourceLocation = n.getObjectValue(createManifestFromDiscriminatorValue); } });
}
exports.deserializeIntoExportSuccessOperation = deserializeIntoExportSuccessOperation;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoFailedOperation(failedOperation = {}) {
    return Object.assign(Object.assign({}, deserializeIntoOperation(failedOperation)), { "error": n => { failedOperation.errorEscaped = n.getObjectValue(__1.createPublicErrorFromDiscriminatorValue); } });
}
exports.deserializeIntoFailedOperation = deserializeIntoFailedOperation;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoManifest(manifest = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(manifest)), { "blobCount": n => { manifest.blobCount = n.getNumberValue(); }, "blobs": n => { manifest.blobs = n.getCollectionOfObjectValues(createBlobFromDiscriminatorValue); }, "createdDateTime": n => { manifest.createdDateTime = n.getDateValue(); }, "dataFormat": n => { manifest.dataFormat = n.getStringValue(); }, "eTag": n => { manifest.eTag = n.getStringValue(); }, "partitionType": n => { manifest.partitionType = n.getStringValue(); }, "partnerTenantId": n => { manifest.partnerTenantId = n.getStringValue(); }, "rootDirectory": n => { manifest.rootDirectory = n.getStringValue(); }, "sasToken": n => { manifest.sasToken = n.getStringValue(); }, "schemaVersion": n => { manifest.schemaVersion = n.getStringValue(); } });
}
exports.deserializeIntoManifest = deserializeIntoManifest;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoManifestCollectionResponse(manifestCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(manifestCollectionResponse)), { "value": n => { manifestCollectionResponse.value = n.getCollectionOfObjectValues(createManifestFromDiscriminatorValue); } });
}
exports.deserializeIntoManifestCollectionResponse = deserializeIntoManifestCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoOperation(operation = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoEntity)(operation)), { "createdDateTime": n => { operation.createdDateTime = n.getDateValue(); }, "lastActionDateTime": n => { operation.lastActionDateTime = n.getDateValue(); }, "status": n => { operation.status = n.getEnumValue(__1.LongRunningOperationStatusObject); } });
}
exports.deserializeIntoOperation = deserializeIntoOperation;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoOperationCollectionResponse(operationCollectionResponse = {}) {
    return Object.assign(Object.assign({}, (0, __1.deserializeIntoBaseCollectionPaginationCountResponse)(operationCollectionResponse)), { "value": n => { operationCollectionResponse.value = n.getCollectionOfObjectValues(createOperationFromDiscriminatorValue); } });
}
exports.deserializeIntoOperationCollectionResponse = deserializeIntoOperationCollectionResponse;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoRunningOperation(runningOperation = {}) {
    return Object.assign({}, deserializeIntoOperation(runningOperation));
}
exports.deserializeIntoRunningOperation = deserializeIntoRunningOperation;
/**
 * The deserialization information for the current model
 * @returns a Record<string, (node: ParseNode) => void>
 */
function deserializeIntoUnbilledUsage(unbilledUsage = {}) {
    return Object.assign({}, (0, __1.deserializeIntoEntity)(unbilledUsage));
}
exports.deserializeIntoUnbilledUsage = deserializeIntoUnbilledUsage;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeAzureUsage(writer, azureUsage = {}) {
    (0, __1.serializeEntity)(writer, azureUsage);
    writer.writeObjectValue("billed", azureUsage.billed, serializeBilledUsage);
    writer.writeObjectValue("unbilled", azureUsage.unbilled, serializeUnbilledUsage);
}
exports.serializeAzureUsage = serializeAzureUsage;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeBilledUsage(writer, billedUsage = {}) {
    (0, __1.serializeEntity)(writer, billedUsage);
}
exports.serializeBilledUsage = serializeBilledUsage;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeBilling(writer, billing = {}) {
    (0, __1.serializeEntity)(writer, billing);
    writer.writeCollectionOfObjectValues("manifests", billing.manifests, serializeManifest);
    writer.writeCollectionOfObjectValues("operations", billing.operations, serializeOperation);
    writer.writeObjectValue("usage", billing.usage, serializeAzureUsage);
}
exports.serializeBilling = serializeBilling;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeBlob(writer, blob = {}) {
    writer.writeStringValue("name", blob.name);
    writer.writeStringValue("@odata.type", blob.odataType);
    writer.writeStringValue("partitionValue", blob.partitionValue);
    writer.writeAdditionalData(blob.additionalData);
}
exports.serializeBlob = serializeBlob;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeExportSuccessOperation(writer, exportSuccessOperation = {}) {
    serializeOperation(writer, exportSuccessOperation);
    writer.writeObjectValue("resourceLocation", exportSuccessOperation.resourceLocation, serializeManifest);
}
exports.serializeExportSuccessOperation = serializeExportSuccessOperation;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeFailedOperation(writer, failedOperation = {}) {
    serializeOperation(writer, failedOperation);
    writer.writeObjectValue("error", failedOperation.errorEscaped, __1.serializePublicError);
}
exports.serializeFailedOperation = serializeFailedOperation;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeManifest(writer, manifest = {}) {
    (0, __1.serializeEntity)(writer, manifest);
    writer.writeNumberValue("blobCount", manifest.blobCount);
    writer.writeCollectionOfObjectValues("blobs", manifest.blobs, serializeBlob);
    writer.writeDateValue("createdDateTime", manifest.createdDateTime);
    writer.writeStringValue("dataFormat", manifest.dataFormat);
    writer.writeStringValue("eTag", manifest.eTag);
    writer.writeStringValue("partitionType", manifest.partitionType);
    writer.writeStringValue("partnerTenantId", manifest.partnerTenantId);
    writer.writeStringValue("rootDirectory", manifest.rootDirectory);
    writer.writeStringValue("sasToken", manifest.sasToken);
    writer.writeStringValue("schemaVersion", manifest.schemaVersion);
}
exports.serializeManifest = serializeManifest;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeManifestCollectionResponse(writer, manifestCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, manifestCollectionResponse);
    writer.writeCollectionOfObjectValues("value", manifestCollectionResponse.value, serializeManifest);
}
exports.serializeManifestCollectionResponse = serializeManifestCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeOperation(writer, operation = {}) {
    (0, __1.serializeEntity)(writer, operation);
    writer.writeDateValue("createdDateTime", operation.createdDateTime);
    writer.writeDateValue("lastActionDateTime", operation.lastActionDateTime);
    writer.writeEnumValue("status", operation.status);
}
exports.serializeOperation = serializeOperation;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeOperationCollectionResponse(writer, operationCollectionResponse = {}) {
    (0, __1.serializeBaseCollectionPaginationCountResponse)(writer, operationCollectionResponse);
    writer.writeCollectionOfObjectValues("value", operationCollectionResponse.value, serializeOperation);
}
exports.serializeOperationCollectionResponse = serializeOperationCollectionResponse;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeRunningOperation(writer, runningOperation = {}) {
    serializeOperation(writer, runningOperation);
}
exports.serializeRunningOperation = serializeRunningOperation;
/**
 * Serializes information the current object
 * @param writer Serialization writer to use to serialize this model
 */
function serializeUnbilledUsage(writer, unbilledUsage = {}) {
    (0, __1.serializeEntity)(writer, unbilledUsage);
}
exports.serializeUnbilledUsage = serializeUnbilledUsage;
exports.AttributeSetObject = {
    Full: "full",
    Basic: "basic",
    UnknownFutureValue: "unknownFutureValue",
};
exports.BillingPeriodObject = {
    Current: "current",
    Last: "last",
    UnknownFutureValue: "unknownFutureValue",
};
/* tslint:enable */
/* eslint-enable */
