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

package query

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/query/schemas"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/query/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 XML lists for the following cases for both input and
// output:
//
//   - Normal XML lists.
//   - Normal XML sets.
//   - XML lists of lists.
//   - XML lists with @xmlName on its members
//   - Flattened XML lists.
//   - Flattened XML lists with @xmlName.
//   - Lists of structures.
func (c *Client) XmlLists(ctx context.Context, params *XmlListsInput, optFns ...func(*Options)) (*XmlListsOutput, error) {
	if params == nil {
		params = &XmlListsInput{}
	}

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

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

type XmlListsInput struct {
	noSmithyDocumentSerde
}

func (v *XmlListsInput) Serialize(s smithy.ShapeSerializer) {
	s.WriteStruct(nil)
	v.SerializeMembers(s)
	s.CloseStruct()
}

func (v *XmlListsInput) SerializeMembers(s smithy.ShapeSerializer) {
}
func (v *XmlListsInput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, nil, func(s *smithy.Schema) error {
		switch s {
		}
		return nil
	})
}

type XmlListsOutput struct {
	BooleanList []bool

	EnumList []types.FooEnum

	FlattenedList []string

	FlattenedList2 []string

	FlattenedListWithMemberNamespace []string

	FlattenedListWithNamespace []string

	IntEnumList []types.IntegerEnum

	IntegerList []int32

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

	RenamedListMembers []string

	StringList []string

	StringSet []string

	StructureList []types.StructureListMember

	TimestampList []time.Time

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

	noSmithyDocumentSerde
}

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

func (v *XmlListsOutput) SerializeMembers(s smithy.ShapeSerializer) {
	serializeBooleanList(s, schemas.XmlListsOutput_booleanList, v.BooleanList)
	serializeFooEnumList(s, schemas.XmlListsOutput_enumList, v.EnumList)
	serializeRenamedListMembers(s, schemas.XmlListsOutput_flattenedList, v.FlattenedList)
	serializeRenamedListMembers(s, schemas.XmlListsOutput_flattenedList2, v.FlattenedList2)
	serializeListWithMemberNamespace(s, schemas.XmlListsOutput_flattenedListWithMemberNamespace, v.FlattenedListWithMemberNamespace)
	serializeListWithNamespace(s, schemas.XmlListsOutput_flattenedListWithNamespace, v.FlattenedListWithNamespace)
	serializeIntegerEnumList(s, schemas.XmlListsOutput_intEnumList, v.IntEnumList)
	serializeIntegerList(s, schemas.XmlListsOutput_integerList, v.IntegerList)
	serializeNestedStringList(s, schemas.XmlListsOutput_nestedStringList, v.NestedStringList)
	serializeRenamedListMembers(s, schemas.XmlListsOutput_renamedListMembers, v.RenamedListMembers)
	serializeStringList(s, schemas.XmlListsOutput_stringList, v.StringList)
	serializeStringSet(s, schemas.XmlListsOutput_stringSet, v.StringSet)
	serializeStructureList(s, schemas.XmlListsOutput_structureList, v.StructureList)
	serializeTimestampList(s, schemas.XmlListsOutput_timestampList, v.TimestampList)
}
func (v *XmlListsOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.XmlListsOutput, func(s *smithy.Schema) error {
		switch s {
		case schemas.XmlListsOutput_booleanList:
			return deserializeBooleanList(d, schemas.XmlListsOutput_booleanList, &v.BooleanList)
		case schemas.XmlListsOutput_enumList:
			return deserializeFooEnumList(d, schemas.XmlListsOutput_enumList, &v.EnumList)
		case schemas.XmlListsOutput_flattenedList:
			return deserializeRenamedListMembers(d, schemas.XmlListsOutput_flattenedList, &v.FlattenedList)
		case schemas.XmlListsOutput_flattenedList2:
			return deserializeRenamedListMembers(d, schemas.XmlListsOutput_flattenedList2, &v.FlattenedList2)
		case schemas.XmlListsOutput_flattenedListWithMemberNamespace:
			return deserializeListWithMemberNamespace(d, schemas.XmlListsOutput_flattenedListWithMemberNamespace, &v.FlattenedListWithMemberNamespace)
		case schemas.XmlListsOutput_flattenedListWithNamespace:
			return deserializeListWithNamespace(d, schemas.XmlListsOutput_flattenedListWithNamespace, &v.FlattenedListWithNamespace)
		case schemas.XmlListsOutput_intEnumList:
			return deserializeIntegerEnumList(d, schemas.XmlListsOutput_intEnumList, &v.IntEnumList)
		case schemas.XmlListsOutput_integerList:
			return deserializeIntegerList(d, schemas.XmlListsOutput_integerList, &v.IntegerList)
		case schemas.XmlListsOutput_nestedStringList:
			return deserializeNestedStringList(d, schemas.XmlListsOutput_nestedStringList, &v.NestedStringList)
		case schemas.XmlListsOutput_renamedListMembers:
			return deserializeRenamedListMembers(d, schemas.XmlListsOutput_renamedListMembers, &v.RenamedListMembers)
		case schemas.XmlListsOutput_stringList:
			return deserializeStringList(d, schemas.XmlListsOutput_stringList, &v.StringList)
		case schemas.XmlListsOutput_stringSet:
			return deserializeStringSet(d, schemas.XmlListsOutput_stringSet, &v.StringSet)
		case schemas.XmlListsOutput_structureList:
			return deserializeStructureList(d, schemas.XmlListsOutput_structureList, &v.StructureList)
		case schemas.XmlListsOutput_timestampList:
			return deserializeTimestampList(d, schemas.XmlListsOutput_timestampList, &v.TimestampList)
		}
		return nil
	})
}
func (c *Client) addOperationXmlListsMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.XmlLists, nil, schemas.XmlListsOutput)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.XmlLists, nil, schemas.XmlListsOutput), output: &XmlListsOutput{}}, 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 = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack, options); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "XmlLists"), 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
}
