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

package restxml

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

// Null headers are not sent over the wire, empty headers are serialized to ""
func (c *Client) NullAndEmptyHeadersClient(ctx context.Context, params *NullAndEmptyHeadersClientInput, optFns ...func(*Options)) (*NullAndEmptyHeadersClientOutput, error) {
	if params == nil {
		params = &NullAndEmptyHeadersClientInput{}
	}

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

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

type NullAndEmptyHeadersClientInput struct {
	A *string

	B *string

	C []string

	noSmithyDocumentSerde
}

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

func (v *NullAndEmptyHeadersClientInput) SerializeMembers(s smithy.ShapeSerializer) {
	if v.A != nil {
		s.WriteString(schemas.NullAndEmptyHeadersIO_a, *v.A)
	}
	if v.B != nil {
		s.WriteString(schemas.NullAndEmptyHeadersIO_b, *v.B)
	}
	serializeStringList(s, schemas.NullAndEmptyHeadersIO_c, v.C)
}
func (v *NullAndEmptyHeadersClientInput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.NullAndEmptyHeadersIO, func(s *smithy.Schema) error {
		switch s {
		case schemas.NullAndEmptyHeadersIO_a:
			v.A = new(string)
			return d.ReadString(schemas.NullAndEmptyHeadersIO_a, v.A)
		case schemas.NullAndEmptyHeadersIO_b:
			v.B = new(string)
			return d.ReadString(schemas.NullAndEmptyHeadersIO_b, v.B)
		case schemas.NullAndEmptyHeadersIO_c:
			return deserializeStringList(d, schemas.NullAndEmptyHeadersIO_c, &v.C)
		}
		return nil
	})
}

type NullAndEmptyHeadersClientOutput struct {
	A *string

	B *string

	C []string

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

	noSmithyDocumentSerde
}

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

func (v *NullAndEmptyHeadersClientOutput) SerializeMembers(s smithy.ShapeSerializer) {
	if v.A != nil {
		s.WriteString(schemas.NullAndEmptyHeadersIO_a, *v.A)
	}
	if v.B != nil {
		s.WriteString(schemas.NullAndEmptyHeadersIO_b, *v.B)
	}
	serializeStringList(s, schemas.NullAndEmptyHeadersIO_c, v.C)
}
func (v *NullAndEmptyHeadersClientOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.NullAndEmptyHeadersIO, func(s *smithy.Schema) error {
		switch s {
		case schemas.NullAndEmptyHeadersIO_a:
			v.A = new(string)
			return d.ReadString(schemas.NullAndEmptyHeadersIO_a, v.A)
		case schemas.NullAndEmptyHeadersIO_b:
			v.B = new(string)
			return d.ReadString(schemas.NullAndEmptyHeadersIO_b, v.B)
		case schemas.NullAndEmptyHeadersIO_c:
			return deserializeStringList(d, schemas.NullAndEmptyHeadersIO_c, &v.C)
		}
		return nil
	})
}
func (c *Client) addOperationNullAndEmptyHeadersClientMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.NullAndEmptyHeadersClient, schemas.NullAndEmptyHeadersIO, schemas.NullAndEmptyHeadersIO)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.NullAndEmptyHeadersClient, schemas.NullAndEmptyHeadersIO, schemas.NullAndEmptyHeadersIO), output: &NullAndEmptyHeadersClientOutput{}}, 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, "NullAndEmptyHeadersClient"), 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
}
