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


package ess

import (
	"context"
	"fmt"
	"github.com/aws/smithy-go/middleware"
	smithy "github.com/aws/smithy-go"
	"github.com/nifcloud/nifcloud-sdk-go/service/ess/types"
)

type validateOpDeleteIdentity struct {
}

func (*validateOpDeleteIdentity) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpDeleteIdentity) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*DeleteIdentityInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpDeleteIdentityInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpGetDeliveryLog struct {
}

func (*validateOpGetDeliveryLog) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpGetDeliveryLog) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*GetDeliveryLogInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpGetDeliveryLogInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpGetIdentityDkimAttributes struct {
}

func (*validateOpGetIdentityDkimAttributes) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpGetIdentityDkimAttributes) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*GetIdentityDkimAttributesInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpGetIdentityDkimAttributesInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpGetIdentityVerificationAttributes struct {
}

func (*validateOpGetIdentityVerificationAttributes) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpGetIdentityVerificationAttributes) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*GetIdentityVerificationAttributesInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpGetIdentityVerificationAttributesInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpSendEmail struct {
}

func (*validateOpSendEmail) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpSendEmail) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*SendEmailInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpSendEmailInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpSendRawEmail struct {
}

func (*validateOpSendRawEmail) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpSendRawEmail) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*SendRawEmailInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpSendRawEmailInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpSetIdentityDkimEnabled struct {
}

func (*validateOpSetIdentityDkimEnabled) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpSetIdentityDkimEnabled) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*SetIdentityDkimEnabledInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpSetIdentityDkimEnabledInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpVerifyDomainDkim struct {
}

func (*validateOpVerifyDomainDkim) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpVerifyDomainDkim) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*VerifyDomainDkimInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpVerifyDomainDkimInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpVerifyDomainIdentity struct {
}

func (*validateOpVerifyDomainIdentity) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpVerifyDomainIdentity) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*VerifyDomainIdentityInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpVerifyDomainIdentityInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpVerifyEmailIdentity struct {
}

func (*validateOpVerifyEmailIdentity) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpVerifyEmailIdentity) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*VerifyEmailIdentityInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpVerifyEmailIdentityInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

func addOpDeleteIdentityValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpDeleteIdentity{}, middleware.After)
}

func addOpGetDeliveryLogValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpGetDeliveryLog{}, middleware.After)
}

func addOpGetIdentityDkimAttributesValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpGetIdentityDkimAttributes{}, middleware.After)
}

func addOpGetIdentityVerificationAttributesValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpGetIdentityVerificationAttributes{}, middleware.After)
}

func addOpSendEmailValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpSendEmail{}, middleware.After)
}

func addOpSendRawEmailValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpSendRawEmail{}, middleware.After)
}

func addOpSetIdentityDkimEnabledValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpSetIdentityDkimEnabled{}, middleware.After)
}

func addOpVerifyDomainDkimValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpVerifyDomainDkim{}, middleware.After)
}

func addOpVerifyDomainIdentityValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpVerifyDomainIdentity{}, middleware.After)
}

func addOpVerifyEmailIdentityValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpVerifyEmailIdentity{}, middleware.After)
}

func validateRequestRawMessage(v *types.RequestRawMessage) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "RequestRawMessage"}
	if v.Data == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Data"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpDeleteIdentityInput(v *DeleteIdentityInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DeleteIdentityInput"}
	if v.Identity == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Identity"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpGetDeliveryLogInput(v *GetDeliveryLogInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "GetDeliveryLogInput"}
	if v.EndDate == nil {
	invalidParams.Add(smithy.NewErrParamRequired("EndDate"))
	}
	if v.StartDate == nil {
	invalidParams.Add(smithy.NewErrParamRequired("StartDate"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpGetIdentityDkimAttributesInput(v *GetIdentityDkimAttributesInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "GetIdentityDkimAttributesInput"}
	if v.Identities == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Identities"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpGetIdentityVerificationAttributesInput(v *GetIdentityVerificationAttributesInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "GetIdentityVerificationAttributesInput"}
	if v.Identities == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Identities"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpSendEmailInput(v *SendEmailInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "SendEmailInput"}
	if v.Source == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Source"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpSendRawEmailInput(v *SendRawEmailInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "SendRawEmailInput"}
	if v.RawMessage == nil {
	invalidParams.Add(smithy.NewErrParamRequired("RawMessage"))
	} else if v.RawMessage != nil {
		if err := validateRequestRawMessage(v.RawMessage); err != nil {
			invalidParams.AddNested("RawMessage", err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpSetIdentityDkimEnabledInput(v *SetIdentityDkimEnabledInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "SetIdentityDkimEnabledInput"}
	if len(v.DkimEnabled) == 0 {
	invalidParams.Add(smithy.NewErrParamRequired("DkimEnabled"))
	}
	if v.Identity == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Identity"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpVerifyDomainDkimInput(v *VerifyDomainDkimInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "VerifyDomainDkimInput"}
	if v.Domain == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Domain"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpVerifyDomainIdentityInput(v *VerifyDomainIdentityInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "VerifyDomainIdentityInput"}
	if v.Domain == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Domain"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpVerifyEmailIdentityInput(v *VerifyEmailIdentityInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "VerifyEmailIdentityInput"}
	if v.EmailAddress == nil {
	invalidParams.Add(smithy.NewErrParamRequired("EmailAddress"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}
