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

package awsrestjson

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

// Omits serializing empty lists. Because empty strings are serilized as Foo= ,
// empty lists cannot also be serialized as Foo= and instead must be omitted.
func (c *Client) OmitsSerializingEmptyLists(ctx context.Context, params *OmitsSerializingEmptyListsInput, optFns ...func(*Options)) (*OmitsSerializingEmptyListsOutput, error) {
	if params == nil {
		params = &OmitsSerializingEmptyListsInput{}
	}

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

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

type OmitsSerializingEmptyListsInput struct {
	QueryBooleanList []bool

	QueryDoubleList []float64

	QueryEnumList []types.FooEnum

	QueryIntegerEnumList []types.IntegerEnum

	QueryIntegerList []int32

	QueryStringList []string

	QueryTimestampList []time.Time

	noSmithyDocumentSerde
}

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

func (v *OmitsSerializingEmptyListsInput) SerializeMembers(s smithy.ShapeSerializer) {
	serializeBooleanList(s, schemas.OmitsSerializingEmptyListsInput_queryBooleanList, v.QueryBooleanList)
	serializeDoubleList(s, schemas.OmitsSerializingEmptyListsInput_queryDoubleList, v.QueryDoubleList)
	serializeFooEnumList(s, schemas.OmitsSerializingEmptyListsInput_queryEnumList, v.QueryEnumList)
	serializeIntegerEnumList(s, schemas.OmitsSerializingEmptyListsInput_queryIntegerEnumList, v.QueryIntegerEnumList)
	serializeIntegerList(s, schemas.OmitsSerializingEmptyListsInput_queryIntegerList, v.QueryIntegerList)
	serializeStringList(s, schemas.OmitsSerializingEmptyListsInput_queryStringList, v.QueryStringList)
	serializeTimestampList(s, schemas.OmitsSerializingEmptyListsInput_queryTimestampList, v.QueryTimestampList)
}
func (v *OmitsSerializingEmptyListsInput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.OmitsSerializingEmptyListsInput, func(s *smithy.Schema) error {
		switch s {
		case schemas.OmitsSerializingEmptyListsInput_queryBooleanList:
			return deserializeBooleanList(d, schemas.OmitsSerializingEmptyListsInput_queryBooleanList, &v.QueryBooleanList)
		case schemas.OmitsSerializingEmptyListsInput_queryDoubleList:
			return deserializeDoubleList(d, schemas.OmitsSerializingEmptyListsInput_queryDoubleList, &v.QueryDoubleList)
		case schemas.OmitsSerializingEmptyListsInput_queryEnumList:
			return deserializeFooEnumList(d, schemas.OmitsSerializingEmptyListsInput_queryEnumList, &v.QueryEnumList)
		case schemas.OmitsSerializingEmptyListsInput_queryIntegerEnumList:
			return deserializeIntegerEnumList(d, schemas.OmitsSerializingEmptyListsInput_queryIntegerEnumList, &v.QueryIntegerEnumList)
		case schemas.OmitsSerializingEmptyListsInput_queryIntegerList:
			return deserializeIntegerList(d, schemas.OmitsSerializingEmptyListsInput_queryIntegerList, &v.QueryIntegerList)
		case schemas.OmitsSerializingEmptyListsInput_queryStringList:
			return deserializeStringList(d, schemas.OmitsSerializingEmptyListsInput_queryStringList, &v.QueryStringList)
		case schemas.OmitsSerializingEmptyListsInput_queryTimestampList:
			return deserializeTimestampList(d, schemas.OmitsSerializingEmptyListsInput_queryTimestampList, &v.QueryTimestampList)
		}
		return nil
	})
}

type OmitsSerializingEmptyListsOutput struct {
	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

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

func (v *OmitsSerializingEmptyListsOutput) SerializeMembers(s smithy.ShapeSerializer) {
}
func (v *OmitsSerializingEmptyListsOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, nil, func(s *smithy.Schema) error {
		switch s {
		}
		return nil
	})
}
func (c *Client) addOperationOmitsSerializingEmptyListsMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.OmitsSerializingEmptyLists, schemas.OmitsSerializingEmptyListsInput, nil)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.OmitsSerializingEmptyLists, schemas.OmitsSerializingEmptyListsInput, nil), output: &OmitsSerializingEmptyListsOutput{}}, 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, "OmitsSerializingEmptyLists"), 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
}
