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

package account

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

type validateOpAcceptPrimaryEmailUpdate struct {
}

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

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

type validateOpDeleteAlternateContact struct {
}

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

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

type validateOpDisableRegion struct {
}

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

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

type validateOpEnableRegion struct {
}

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

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

type validateOpGetAlternateContact struct {
}

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

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

type validateOpGetPrimaryEmail struct {
}

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

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

type validateOpGetRegionOptStatus struct {
}

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

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

type validateOpPutAccountName struct {
}

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

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

type validateOpPutAlternateContact struct {
}

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

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

type validateOpPutContactInformation struct {
}

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

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

type validateOpStartPrimaryEmailUpdate struct {
}

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

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

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

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

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

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

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

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

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

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

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

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

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

func validateContactInformation(v *types.ContactInformation) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "ContactInformation"}
	if v.FullName == nil {
		invalidParams.Add(smithy.NewErrParamRequired("FullName"))
	}
	if v.AddressLine1 == nil {
		invalidParams.Add(smithy.NewErrParamRequired("AddressLine1"))
	}
	if v.City == nil {
		invalidParams.Add(smithy.NewErrParamRequired("City"))
	}
	if v.PostalCode == nil {
		invalidParams.Add(smithy.NewErrParamRequired("PostalCode"))
	}
	if v.CountryCode == nil {
		invalidParams.Add(smithy.NewErrParamRequired("CountryCode"))
	}
	if v.PhoneNumber == nil {
		invalidParams.Add(smithy.NewErrParamRequired("PhoneNumber"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateOpAcceptPrimaryEmailUpdateInput(v *AcceptPrimaryEmailUpdateInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "AcceptPrimaryEmailUpdateInput"}
	if v.AccountId == nil {
		invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
	}
	if v.PrimaryEmail == nil {
		invalidParams.Add(smithy.NewErrParamRequired("PrimaryEmail"))
	}
	if v.Otp == nil {
		invalidParams.Add(smithy.NewErrParamRequired("Otp"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateOpDeleteAlternateContactInput(v *DeleteAlternateContactInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DeleteAlternateContactInput"}
	if len(v.AlternateContactType) == 0 {
		invalidParams.Add(smithy.NewErrParamRequired("AlternateContactType"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

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

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

func validateOpGetAlternateContactInput(v *GetAlternateContactInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "GetAlternateContactInput"}
	if len(v.AlternateContactType) == 0 {
		invalidParams.Add(smithy.NewErrParamRequired("AlternateContactType"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

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

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

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

func validateOpPutAlternateContactInput(v *PutAlternateContactInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "PutAlternateContactInput"}
	if v.Name == nil {
		invalidParams.Add(smithy.NewErrParamRequired("Name"))
	}
	if v.Title == nil {
		invalidParams.Add(smithy.NewErrParamRequired("Title"))
	}
	if v.EmailAddress == nil {
		invalidParams.Add(smithy.NewErrParamRequired("EmailAddress"))
	}
	if v.PhoneNumber == nil {
		invalidParams.Add(smithy.NewErrParamRequired("PhoneNumber"))
	}
	if len(v.AlternateContactType) == 0 {
		invalidParams.Add(smithy.NewErrParamRequired("AlternateContactType"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateOpPutContactInformationInput(v *PutContactInformationInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "PutContactInformationInput"}
	if v.ContactInformation == nil {
		invalidParams.Add(smithy.NewErrParamRequired("ContactInformation"))
	} else if v.ContactInformation != nil {
		if err := validateContactInformation(v.ContactInformation); err != nil {
			invalidParams.AddNested("ContactInformation", err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateOpStartPrimaryEmailUpdateInput(v *StartPrimaryEmailUpdateInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "StartPrimaryEmailUpdateInput"}
	if v.AccountId == nil {
		invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
	}
	if v.PrimaryEmail == nil {
		invalidParams.Add(smithy.NewErrParamRequired("PrimaryEmail"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}
