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

package route53recoverycluster

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

type validateOpGetRoutingControlState struct {
}

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

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

type validateOpUpdateRoutingControlState struct {
}

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

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

type validateOpUpdateRoutingControlStates struct {
}

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

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

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

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

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

func validateUpdateRoutingControlStateEntries(v []types.UpdateRoutingControlStateEntry) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "UpdateRoutingControlStateEntries"}
	for i := range v {
		if err := validateUpdateRoutingControlStateEntry(&v[i]); err != nil {
			invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateUpdateRoutingControlStateEntry(v *types.UpdateRoutingControlStateEntry) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "UpdateRoutingControlStateEntry"}
	if v.RoutingControlArn == nil {
		invalidParams.Add(smithy.NewErrParamRequired("RoutingControlArn"))
	}
	if len(v.RoutingControlState) == 0 {
		invalidParams.Add(smithy.NewErrParamRequired("RoutingControlState"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

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

func validateOpUpdateRoutingControlStateInput(v *UpdateRoutingControlStateInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "UpdateRoutingControlStateInput"}
	if v.RoutingControlArn == nil {
		invalidParams.Add(smithy.NewErrParamRequired("RoutingControlArn"))
	}
	if len(v.RoutingControlState) == 0 {
		invalidParams.Add(smithy.NewErrParamRequired("RoutingControlState"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateOpUpdateRoutingControlStatesInput(v *UpdateRoutingControlStatesInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "UpdateRoutingControlStatesInput"}
	if v.UpdateRoutingControlStateEntries == nil {
		invalidParams.Add(smithy.NewErrParamRequired("UpdateRoutingControlStateEntries"))
	} else if v.UpdateRoutingControlStateEntries != nil {
		if err := validateUpdateRoutingControlStateEntries(v.UpdateRoutingControlStateEntries); err != nil {
			invalidParams.AddNested("UpdateRoutingControlStateEntries", err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}
