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

package health

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

type validateOpDescribeAffectedAccountsForOrganization struct {
}

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

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

type validateOpDescribeAffectedEntitiesForOrganization struct {
}

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

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

type validateOpDescribeAffectedEntities struct {
}

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

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

type validateOpDescribeEventAggregates struct {
}

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

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

type validateOpDescribeEventDetailsForOrganization struct {
}

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

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

type validateOpDescribeEventDetails struct {
}

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

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

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

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

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

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

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

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

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

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

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

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

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

func validateOpDescribeAffectedEntitiesForOrganizationInput(v *DescribeAffectedEntitiesForOrganizationInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DescribeAffectedEntitiesForOrganizationInput"}
	if v.OrganizationEntityFilters == nil {
		invalidParams.Add(smithy.NewErrParamRequired("OrganizationEntityFilters"))
	} else if v.OrganizationEntityFilters != nil {
		if err := validateOrganizationEntityFiltersList(v.OrganizationEntityFilters); err != nil {
			invalidParams.AddNested("OrganizationEntityFilters", err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

func validateOpDescribeAffectedEntitiesInput(v *DescribeAffectedEntitiesInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DescribeAffectedEntitiesInput"}
	if v.Filter == nil {
		invalidParams.Add(smithy.NewErrParamRequired("Filter"))
	} else if v.Filter != nil {
		if err := validateEntityFilter(v.Filter); err != nil {
			invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

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

func validateOpDescribeEventDetailsForOrganizationInput(v *DescribeEventDetailsForOrganizationInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DescribeEventDetailsForOrganizationInput"}
	if v.OrganizationEventDetailFilters == nil {
		invalidParams.Add(smithy.NewErrParamRequired("OrganizationEventDetailFilters"))
	} else if v.OrganizationEventDetailFilters != nil {
		if err := validateOrganizationEventDetailFiltersList(v.OrganizationEventDetailFilters); err != nil {
			invalidParams.AddNested("OrganizationEventDetailFilters", err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}

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