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

package awsrestjson

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

func (c *Client) MalformedLong(ctx context.Context, params *MalformedLongInput, optFns ...func(*Options)) (*MalformedLongOutput, error) {
	if params == nil {
		params = &MalformedLongInput{}
	}

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

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

type MalformedLongInput struct {

	// This member is required.
	LongInPath *int64

	LongInBody *int64

	LongInHeader *int64

	LongInQuery *int64

	noSmithyDocumentSerde
}

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

func (v *MalformedLongInput) SerializeMembers(s smithy.ShapeSerializer) {
	if v.LongInBody != nil {
		s.WriteInt64(schemas.MalformedLongInput_longInBody, *v.LongInBody)
	}
	if v.LongInHeader != nil {
		s.WriteInt64(schemas.MalformedLongInput_longInHeader, *v.LongInHeader)
	}
	if v.LongInPath != nil {
		s.WriteInt64(schemas.MalformedLongInput_longInPath, *v.LongInPath)
	}
	if v.LongInQuery != nil {
		s.WriteInt64(schemas.MalformedLongInput_longInQuery, *v.LongInQuery)
	}
}
func (v *MalformedLongInput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.MalformedLongInput, func(s *smithy.Schema) error {
		switch s {
		case schemas.MalformedLongInput_longInBody:
			v.LongInBody = new(int64)
			return d.ReadInt64(schemas.MalformedLongInput_longInBody, v.LongInBody)
		case schemas.MalformedLongInput_longInHeader:
			v.LongInHeader = new(int64)
			return d.ReadInt64(schemas.MalformedLongInput_longInHeader, v.LongInHeader)
		case schemas.MalformedLongInput_longInPath:
			v.LongInPath = new(int64)
			return d.ReadInt64(schemas.MalformedLongInput_longInPath, v.LongInPath)
		case schemas.MalformedLongInput_longInQuery:
			v.LongInQuery = new(int64)
			return d.ReadInt64(schemas.MalformedLongInput_longInQuery, v.LongInQuery)
		}
		return nil
	})
}

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

	noSmithyDocumentSerde
}

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

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