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

package kinesisvideosignaling

import (
	"context"
	"fmt"
	smithy "github.com/aws/smithy-go"
	"github.com/aws/smithy-go/middleware"
)

type validateOpGetIceServerConfig struct {
}

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

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

type validateOpSendAlexaOfferToMaster struct {
}

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

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

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

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

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

func validateOpSendAlexaOfferToMasterInput(v *SendAlexaOfferToMasterInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "SendAlexaOfferToMasterInput"}
	if v.ChannelARN == nil {
		invalidParams.Add(smithy.NewErrParamRequired("ChannelARN"))
	}
	if v.SenderClientId == nil {
		invalidParams.Add(smithy.NewErrParamRequired("SenderClientId"))
	}
	if v.MessagePayload == nil {
		invalidParams.Add(smithy.NewErrParamRequired("MessagePayload"))
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	} else {
		return nil
	}
}
