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

commonMain.aws.sdk.kotlin.services.outposts.serde.OrderDocumentDeserializer.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.Order
import aws.sdk.kotlin.services.outposts.model.OrderStatus
import aws.sdk.kotlin.services.outposts.model.OrderType
import aws.sdk.kotlin.services.outposts.model.PaymentOption
import aws.sdk.kotlin.services.outposts.model.PaymentTerm
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 aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf

internal fun deserializeOrderDocument(deserializer: Deserializer): Order {
    val builder = Order.Builder()
    val LINEITEMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("LineItems"))
    val ORDERFULFILLEDDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("OrderFulfilledDate"))
    val ORDERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OrderId"))
    val ORDERSUBMISSIONDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("OrderSubmissionDate"))
    val ORDERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("OrderType"))
    val OUTPOSTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OutpostId"))
    val PAYMENTOPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PaymentOption"))
    val PAYMENTTERM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PaymentTerm"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(LINEITEMS_DESCRIPTOR)
        field(ORDERFULFILLEDDATE_DESCRIPTOR)
        field(ORDERID_DESCRIPTOR)
        field(ORDERSUBMISSIONDATE_DESCRIPTOR)
        field(ORDERTYPE_DESCRIPTOR)
        field(OUTPOSTID_DESCRIPTOR)
        field(PAYMENTOPTION_DESCRIPTOR)
        field(PAYMENTTERM_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                LINEITEMS_DESCRIPTOR.index -> builder.lineItems =
                    deserializer.deserializeList(LINEITEMS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLineItemDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ORDERFULFILLEDDATE_DESCRIPTOR.index -> builder.orderFulfilledDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                ORDERID_DESCRIPTOR.index -> builder.orderId = deserializeString()
                ORDERSUBMISSIONDATE_DESCRIPTOR.index -> builder.orderSubmissionDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                ORDERTYPE_DESCRIPTOR.index -> builder.orderType = deserializeString().let { OrderType.fromValue(it) }
                OUTPOSTID_DESCRIPTOR.index -> builder.outpostId = deserializeString()
                PAYMENTOPTION_DESCRIPTOR.index -> builder.paymentOption = deserializeString().let { PaymentOption.fromValue(it) }
                PAYMENTTERM_DESCRIPTOR.index -> builder.paymentTerm = deserializeString().let { PaymentTerm.fromValue(it) }
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { OrderStatus.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy