All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.outposts.serde.LineItemDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.outposts.serde

import aws.sdk.kotlin.services.outposts.model.LineItem
import aws.sdk.kotlin.services.outposts.model.LineItemAssetInformation
import aws.sdk.kotlin.services.outposts.model.LineItemStatus
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import kotlin.collections.mutableListOf

internal fun deserializeLineItemDocument(deserializer: Deserializer): LineItem {
    val builder = LineItem.Builder()
    val ASSETINFORMATIONLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AssetInformationList"))
    val CATALOGITEMID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CatalogItemId"))
    val LINEITEMID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LineItemId"))
    val PREVIOUSLINEITEMID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PreviousLineItemId"))
    val PREVIOUSORDERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PreviousOrderId"))
    val QUANTITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Quantity"))
    val SHIPMENTINFORMATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ShipmentInformation"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ASSETINFORMATIONLIST_DESCRIPTOR)
        field(CATALOGITEMID_DESCRIPTOR)
        field(LINEITEMID_DESCRIPTOR)
        field(PREVIOUSLINEITEMID_DESCRIPTOR)
        field(PREVIOUSORDERID_DESCRIPTOR)
        field(QUANTITY_DESCRIPTOR)
        field(SHIPMENTINFORMATION_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ASSETINFORMATIONLIST_DESCRIPTOR.index -> builder.assetInformationList =
                    deserializer.deserializeList(ASSETINFORMATIONLIST_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLineItemAssetInformationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CATALOGITEMID_DESCRIPTOR.index -> builder.catalogItemId = deserializeString()
                LINEITEMID_DESCRIPTOR.index -> builder.lineItemId = deserializeString()
                PREVIOUSLINEITEMID_DESCRIPTOR.index -> builder.previousLineItemId = deserializeString()
                PREVIOUSORDERID_DESCRIPTOR.index -> builder.previousOrderId = deserializeString()
                QUANTITY_DESCRIPTOR.index -> builder.quantity = deserializeInt()
                SHIPMENTINFORMATION_DESCRIPTOR.index -> builder.shipmentInformation = deserializeShipmentInformationDocument(deserializer)
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { LineItemStatus.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy