// 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"
)

func (c *Client) XmlEmptyStrings(ctx context.Context, params *XmlEmptyStringsInput, optFns ...func(*Options)) (*XmlEmptyStringsOutput, error) {
	if params == nil {
		params = &XmlEmptyStringsInput{}
	}

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

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

type XmlEmptyStringsInput struct {
	EmptyString *string

	noSmithyDocumentSerde
}

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

func (v *XmlEmptyStringsInput) SerializeMembers(s smithy.ShapeSerializer) {
	if v.EmptyString != nil {
		s.WriteString(schemas.XmlEmptyStringsRequest_emptyString, *v.EmptyString)
	}
}

type XmlEmptyStringsOutput struct {
	EmptyString *string

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

	noSmithyDocumentSerde
}

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

func (v *XmlEmptyStringsOutput) SerializeMembers(s smithy.ShapeSerializer) {
	if v.EmptyString != nil {
		s.WriteString(schemas.XmlEmptyStringsResponse_emptyString, *v.EmptyString)
	}
}
func (v *XmlEmptyStringsOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.XmlEmptyStringsResponse, func(s *smithy.Schema) error {
		switch s {
		case schemas.XmlEmptyStringsResponse_emptyString:
			v.EmptyString = new(string)
			return d.ReadString(schemas.XmlEmptyStringsResponse_emptyString, v.EmptyString)
		}
		return nil
	})
}
func (c *Client) addOperationXmlEmptyStringsMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.XmlEmptyStrings, schemas.XmlEmptyStringsRequest, schemas.XmlEmptyStringsResponse)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.XmlEmptyStrings, schemas.XmlEmptyStringsRequest, schemas.XmlEmptyStringsResponse), output: &XmlEmptyStringsOutput{}}, 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, "XmlEmptyStrings"), 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
}
