// Code generated by smithy-go-codegen DO NOT EDIT.

package smithyrpcv2cbor

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/smithyrpcv2cbor/schemas"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/smithyrpcv2cbor/types"
	smithy "github.com/aws/smithy-go"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
	"time"
)

// This test case serializes JSON lists for the following cases for both input and
// output:
//
//   - Normal lists.
//   - Normal sets.
//   - Lists of lists.
//   - Lists of structures.
func (c *Client) RpcV2CborLists(ctx context.Context, params *RpcV2CborListsInput, optFns ...func(*Options)) (*RpcV2CborListsOutput, error) {
	if params == nil {
		params = &RpcV2CborListsInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "RpcV2CborLists", params, optFns, c.addOperationRpcV2CborListsMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*RpcV2CborListsOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type RpcV2CborListsInput struct {
	BlobList [][]byte

	BooleanList []bool

	EnumList []types.FooEnum

	IntEnumList []types.IntegerEnum

	IntegerList []int32

	// A list of lists of strings.
	NestedStringList [][]string

	StringList []string

	StringSet []string

	StructureList []types.StructureListMember

	TimestampList []time.Time

	noSmithyDocumentSerde
}

func (v *RpcV2CborListsInput) Serialize(s smithy.ShapeSerializer) {
	s.WriteStruct(schemas.RpcV2CborListInputOutput)
	v.SerializeMembers(s)
	s.CloseStruct()
}

func (v *RpcV2CborListsInput) SerializeMembers(s smithy.ShapeSerializer) {
	serializeBlobList(s, schemas.RpcV2CborListInputOutput_blobList, v.BlobList)
	serializeBooleanList(s, schemas.RpcV2CborListInputOutput_booleanList, v.BooleanList)
	serializeFooEnumList(s, schemas.RpcV2CborListInputOutput_enumList, v.EnumList)
	serializeIntegerEnumList(s, schemas.RpcV2CborListInputOutput_intEnumList, v.IntEnumList)
	serializeIntegerList(s, schemas.RpcV2CborListInputOutput_integerList, v.IntegerList)
	serializeNestedStringList(s, schemas.RpcV2CborListInputOutput_nestedStringList, v.NestedStringList)
	serializeStringList(s, schemas.RpcV2CborListInputOutput_stringList, v.StringList)
	serializeStringSet(s, schemas.RpcV2CborListInputOutput_stringSet, v.StringSet)
	serializeStructureList(s, schemas.RpcV2CborListInputOutput_structureList, v.StructureList)
	serializeTimestampList(s, schemas.RpcV2CborListInputOutput_timestampList, v.TimestampList)
}
func (v *RpcV2CborListsInput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.RpcV2CborListInputOutput, func(s *smithy.Schema) error {
		switch s {
		case schemas.RpcV2CborListInputOutput_blobList:
			return deserializeBlobList(d, schemas.RpcV2CborListInputOutput_blobList, &v.BlobList)
		case schemas.RpcV2CborListInputOutput_booleanList:
			return deserializeBooleanList(d, schemas.RpcV2CborListInputOutput_booleanList, &v.BooleanList)
		case schemas.RpcV2CborListInputOutput_enumList:
			return deserializeFooEnumList(d, schemas.RpcV2CborListInputOutput_enumList, &v.EnumList)
		case schemas.RpcV2CborListInputOutput_intEnumList:
			return deserializeIntegerEnumList(d, schemas.RpcV2CborListInputOutput_intEnumList, &v.IntEnumList)
		case schemas.RpcV2CborListInputOutput_integerList:
			return deserializeIntegerList(d, schemas.RpcV2CborListInputOutput_integerList, &v.IntegerList)
		case schemas.RpcV2CborListInputOutput_nestedStringList:
			return deserializeNestedStringList(d, schemas.RpcV2CborListInputOutput_nestedStringList, &v.NestedStringList)
		case schemas.RpcV2CborListInputOutput_stringList:
			return deserializeStringList(d, schemas.RpcV2CborListInputOutput_stringList, &v.StringList)
		case schemas.RpcV2CborListInputOutput_stringSet:
			return deserializeStringSet(d, schemas.RpcV2CborListInputOutput_stringSet, &v.StringSet)
		case schemas.RpcV2CborListInputOutput_structureList:
			return deserializeStructureList(d, schemas.RpcV2CborListInputOutput_structureList, &v.StructureList)
		case schemas.RpcV2CborListInputOutput_timestampList:
			return deserializeTimestampList(d, schemas.RpcV2CborListInputOutput_timestampList, &v.TimestampList)
		}
		return nil
	})
}

type RpcV2CborListsOutput struct {
	BlobList [][]byte

	BooleanList []bool

	EnumList []types.FooEnum

	IntEnumList []types.IntegerEnum

	IntegerList []int32

	// A list of lists of strings.
	NestedStringList [][]string

	StringList []string

	StringSet []string

	StructureList []types.StructureListMember

	TimestampList []time.Time

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (v *RpcV2CborListsOutput) Serialize(s smithy.ShapeSerializer) {
	s.WriteStruct(schemas.RpcV2CborListInputOutput)
	v.SerializeMembers(s)
	s.CloseStruct()
}

func (v *RpcV2CborListsOutput) SerializeMembers(s smithy.ShapeSerializer) {
	serializeBlobList(s, schemas.RpcV2CborListInputOutput_blobList, v.BlobList)
	serializeBooleanList(s, schemas.RpcV2CborListInputOutput_booleanList, v.BooleanList)
	serializeFooEnumList(s, schemas.RpcV2CborListInputOutput_enumList, v.EnumList)
	serializeIntegerEnumList(s, schemas.RpcV2CborListInputOutput_intEnumList, v.IntEnumList)
	serializeIntegerList(s, schemas.RpcV2CborListInputOutput_integerList, v.IntegerList)
	serializeNestedStringList(s, schemas.RpcV2CborListInputOutput_nestedStringList, v.NestedStringList)
	serializeStringList(s, schemas.RpcV2CborListInputOutput_stringList, v.StringList)
	serializeStringSet(s, schemas.RpcV2CborListInputOutput_stringSet, v.StringSet)
	serializeStructureList(s, schemas.RpcV2CborListInputOutput_structureList, v.StructureList)
	serializeTimestampList(s, schemas.RpcV2CborListInputOutput_timestampList, v.TimestampList)
}
func (v *RpcV2CborListsOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.RpcV2CborListInputOutput, func(s *smithy.Schema) error {
		switch s {
		case schemas.RpcV2CborListInputOutput_blobList:
			return deserializeBlobList(d, schemas.RpcV2CborListInputOutput_blobList, &v.BlobList)
		case schemas.RpcV2CborListInputOutput_booleanList:
			return deserializeBooleanList(d, schemas.RpcV2CborListInputOutput_booleanList, &v.BooleanList)
		case schemas.RpcV2CborListInputOutput_enumList:
			return deserializeFooEnumList(d, schemas.RpcV2CborListInputOutput_enumList, &v.EnumList)
		case schemas.RpcV2CborListInputOutput_intEnumList:
			return deserializeIntegerEnumList(d, schemas.RpcV2CborListInputOutput_intEnumList, &v.IntEnumList)
		case schemas.RpcV2CborListInputOutput_integerList:
			return deserializeIntegerList(d, schemas.RpcV2CborListInputOutput_integerList, &v.IntegerList)
		case schemas.RpcV2CborListInputOutput_nestedStringList:
			return deserializeNestedStringList(d, schemas.RpcV2CborListInputOutput_nestedStringList, &v.NestedStringList)
		case schemas.RpcV2CborListInputOutput_stringList:
			return deserializeStringList(d, schemas.RpcV2CborListInputOutput_stringList, &v.StringList)
		case schemas.RpcV2CborListInputOutput_stringSet:
			return deserializeStringSet(d, schemas.RpcV2CborListInputOutput_stringSet, &v.StringSet)
		case schemas.RpcV2CborListInputOutput_structureList:
			return deserializeStructureList(d, schemas.RpcV2CborListInputOutput_structureList, &v.StructureList)
		case schemas.RpcV2CborListInputOutput_timestampList:
			return deserializeTimestampList(d, schemas.RpcV2CborListInputOutput_timestampList, &v.TimestampList)
		}
		return nil
	})
}
func (c *Client) addOperationRpcV2CborListsMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.RpcV2CborLists, schemas.RpcV2CborListInputOutput, schemas.RpcV2CborListInputOutput)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.RpcV2CborLists, schemas.RpcV2CborListInputOutput, schemas.RpcV2CborListInputOutput), output: &RpcV2CborListsOutput{}}, middleware.After); err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addUserAgentFeatureProtocolRPCV2CBOR(stack, options); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "RpcV2CborLists"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
