// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// ActionDispatcher action dispatcher
//
// swagger:model ActionDispatcher
type ActionDispatcher struct {

	// used to explicitly order the actions run when a behavior triggers
	Order int64 `json:"order,omitempty"`

	// publish amqp
	PublishAmqp *ActionPublishAMQP `json:"publish_amqp,omitempty"`

	// publish kafka
	PublishKafka *ActionPublishKafka `json:"publish_kafka,omitempty"`

	// redis
	Redis ActionRedis `json:"redis,omitempty"`

	// reply grpc
	ReplyGrpc *ActionReplyGRPC `json:"reply_grpc,omitempty"`

	// reply http
	ReplyHTTP *ActionReplyHTTP `json:"reply_http,omitempty"`

	// send http
	SendHTTP *ActionSendHTTP `json:"send_http,omitempty"`

	// sleep
	Sleep *ActionSleep `json:"sleep,omitempty"`
}

// Validate validates this action dispatcher
func (m *ActionDispatcher) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validatePublishAmqp(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validatePublishKafka(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateRedis(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateReplyGrpc(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateReplyHTTP(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateSendHTTP(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateSleep(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *ActionDispatcher) validatePublishAmqp(formats strfmt.Registry) error {

	if swag.IsZero(m.PublishAmqp) { // not required
		return nil
	}

	if m.PublishAmqp != nil {
		if err := m.PublishAmqp.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("publish_amqp")
			}
			return err
		}
	}

	return nil
}

func (m *ActionDispatcher) validatePublishKafka(formats strfmt.Registry) error {

	if swag.IsZero(m.PublishKafka) { // not required
		return nil
	}

	if m.PublishKafka != nil {
		if err := m.PublishKafka.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("publish_kafka")
			}
			return err
		}
	}

	return nil
}

func (m *ActionDispatcher) validateRedis(formats strfmt.Registry) error {

	if swag.IsZero(m.Redis) { // not required
		return nil
	}

	if err := m.Redis.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("redis")
		}
		return err
	}

	return nil
}

func (m *ActionDispatcher) validateReplyGrpc(formats strfmt.Registry) error {

	if swag.IsZero(m.ReplyGrpc) { // not required
		return nil
	}

	if m.ReplyGrpc != nil {
		if err := m.ReplyGrpc.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("reply_grpc")
			}
			return err
		}
	}

	return nil
}

func (m *ActionDispatcher) validateReplyHTTP(formats strfmt.Registry) error {

	if swag.IsZero(m.ReplyHTTP) { // not required
		return nil
	}

	if m.ReplyHTTP != nil {
		if err := m.ReplyHTTP.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("reply_http")
			}
			return err
		}
	}

	return nil
}

func (m *ActionDispatcher) validateSendHTTP(formats strfmt.Registry) error {

	if swag.IsZero(m.SendHTTP) { // not required
		return nil
	}

	if m.SendHTTP != nil {
		if err := m.SendHTTP.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("send_http")
			}
			return err
		}
	}

	return nil
}

func (m *ActionDispatcher) validateSleep(formats strfmt.Registry) error {

	if swag.IsZero(m.Sleep) { // not required
		return nil
	}

	if m.Sleep != nil {
		if err := m.Sleep.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("sleep")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (m *ActionDispatcher) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *ActionDispatcher) UnmarshalBinary(b []byte) error {
	var res ActionDispatcher
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
