// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: cmd/kas/kasapp/kasapp.proto

package kasapp

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"sort"
	"strings"
	"time"
	"unicode/utf8"

	"google.golang.org/protobuf/types/known/anypb"
)

// ensure the imports are used
var (
	_ = bytes.MinRead
	_ = errors.New("")
	_ = fmt.Print
	_ = utf8.UTFMax
	_ = (*regexp.Regexp)(nil)
	_ = (*strings.Reader)(nil)
	_ = net.IPv4len
	_ = time.Duration(0)
	_ = (*url.URL)(nil)
	_ = (*mail.Address)(nil)
	_ = anypb.Any{}
	_ = sort.Sort
)

// Validate checks the field values on StartStreaming with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *StartStreaming) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on StartStreaming with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in StartStreamingMultiError,
// or nil if none found.
func (m *StartStreaming) ValidateAll() error {
	return m.validate(true)
}

func (m *StartStreaming) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return StartStreamingMultiError(errors)
	}

	return nil
}

// StartStreamingMultiError is an error wrapping multiple validation errors
// returned by StartStreaming.ValidateAll() if the designated constraints
// aren't met.
type StartStreamingMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m StartStreamingMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m StartStreamingMultiError) AllErrors() []error { return m }

// StartStreamingValidationError is the validation error returned by
// StartStreaming.Validate if the designated constraints aren't met.
type StartStreamingValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e StartStreamingValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e StartStreamingValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e StartStreamingValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e StartStreamingValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e StartStreamingValidationError) ErrorName() string { return "StartStreamingValidationError" }

// Error satisfies the builtin error interface
func (e StartStreamingValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sStartStreaming.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = StartStreamingValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = StartStreamingValidationError{}

// Validate checks the field values on GatewayKasResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GatewayKasResponseMultiError, or nil if none found.
func (m *GatewayKasResponse) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	oneofMsgPresent := false
	switch v := m.Msg.(type) {
	case *GatewayKasResponse_TunnelReady_:
		if v == nil {
			err := GatewayKasResponseValidationError{
				field:  "Msg",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMsgPresent = true

		if m.GetTunnelReady() == nil {
			err := GatewayKasResponseValidationError{
				field:  "TunnelReady",
				reason: "value is required",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetTunnelReady()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "TunnelReady",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "TunnelReady",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetTunnelReady()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return GatewayKasResponseValidationError{
					field:  "TunnelReady",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *GatewayKasResponse_Header_:
		if v == nil {
			err := GatewayKasResponseValidationError{
				field:  "Msg",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMsgPresent = true

		if m.GetHeader() == nil {
			err := GatewayKasResponseValidationError{
				field:  "Header",
				reason: "value is required",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetHeader()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Header",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Header",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return GatewayKasResponseValidationError{
					field:  "Header",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *GatewayKasResponse_Message_:
		if v == nil {
			err := GatewayKasResponseValidationError{
				field:  "Msg",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMsgPresent = true

		if m.GetMessage() == nil {
			err := GatewayKasResponseValidationError{
				field:  "Message",
				reason: "value is required",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetMessage()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Message",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Message",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMessage()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return GatewayKasResponseValidationError{
					field:  "Message",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *GatewayKasResponse_Trailer_:
		if v == nil {
			err := GatewayKasResponseValidationError{
				field:  "Msg",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMsgPresent = true

		if m.GetTrailer() == nil {
			err := GatewayKasResponseValidationError{
				field:  "Trailer",
				reason: "value is required",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetTrailer()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Trailer",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Trailer",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetTrailer()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return GatewayKasResponseValidationError{
					field:  "Trailer",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *GatewayKasResponse_Error_:
		if v == nil {
			err := GatewayKasResponseValidationError{
				field:  "Msg",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMsgPresent = true

		if m.GetError() == nil {
			err := GatewayKasResponseValidationError{
				field:  "Error",
				reason: "value is required",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetError()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Error",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "Error",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return GatewayKasResponseValidationError{
					field:  "Error",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *GatewayKasResponse_NoTunnel_:
		if v == nil {
			err := GatewayKasResponseValidationError{
				field:  "Msg",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMsgPresent = true

		if m.GetNoTunnel() == nil {
			err := GatewayKasResponseValidationError{
				field:  "NoTunnel",
				reason: "value is required",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetNoTunnel()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "NoTunnel",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, GatewayKasResponseValidationError{
						field:  "NoTunnel",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetNoTunnel()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return GatewayKasResponseValidationError{
					field:  "NoTunnel",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofMsgPresent {
		err := GatewayKasResponseValidationError{
			field:  "Msg",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return GatewayKasResponseMultiError(errors)
	}

	return nil
}

// GatewayKasResponseMultiError is an error wrapping multiple validation errors
// returned by GatewayKasResponse.ValidateAll() if the designated constraints
// aren't met.
type GatewayKasResponseMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponseMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponseMultiError) AllErrors() []error { return m }

// GatewayKasResponseValidationError is the validation error returned by
// GatewayKasResponse.Validate if the designated constraints aren't met.
type GatewayKasResponseValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponseValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponseValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponseValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponseValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponseValidationError) ErrorName() string {
	return "GatewayKasResponseValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponseValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponseValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponseValidationError{}

// Validate checks the field values on GatewayKasResponse_TunnelReady with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse_TunnelReady) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse_TunnelReady with
// the rules defined in the proto definition for this message. If any rules
// are violated, the result is a list of violation errors wrapped in
// GatewayKasResponse_TunnelReadyMultiError, or nil if none found.
func (m *GatewayKasResponse_TunnelReady) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse_TunnelReady) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return GatewayKasResponse_TunnelReadyMultiError(errors)
	}

	return nil
}

// GatewayKasResponse_TunnelReadyMultiError is an error wrapping multiple
// validation errors returned by GatewayKasResponse_TunnelReady.ValidateAll()
// if the designated constraints aren't met.
type GatewayKasResponse_TunnelReadyMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponse_TunnelReadyMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponse_TunnelReadyMultiError) AllErrors() []error { return m }

// GatewayKasResponse_TunnelReadyValidationError is the validation error
// returned by GatewayKasResponse_TunnelReady.Validate if the designated
// constraints aren't met.
type GatewayKasResponse_TunnelReadyValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponse_TunnelReadyValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponse_TunnelReadyValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponse_TunnelReadyValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponse_TunnelReadyValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponse_TunnelReadyValidationError) ErrorName() string {
	return "GatewayKasResponse_TunnelReadyValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponse_TunnelReadyValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse_TunnelReady.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponse_TunnelReadyValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponse_TunnelReadyValidationError{}

// Validate checks the field values on GatewayKasResponse_NoTunnel with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse_NoTunnel) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse_NoTunnel with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GatewayKasResponse_NoTunnelMultiError, or nil if none found.
func (m *GatewayKasResponse_NoTunnel) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse_NoTunnel) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return GatewayKasResponse_NoTunnelMultiError(errors)
	}

	return nil
}

// GatewayKasResponse_NoTunnelMultiError is an error wrapping multiple
// validation errors returned by GatewayKasResponse_NoTunnel.ValidateAll() if
// the designated constraints aren't met.
type GatewayKasResponse_NoTunnelMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponse_NoTunnelMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponse_NoTunnelMultiError) AllErrors() []error { return m }

// GatewayKasResponse_NoTunnelValidationError is the validation error returned
// by GatewayKasResponse_NoTunnel.Validate if the designated constraints
// aren't met.
type GatewayKasResponse_NoTunnelValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponse_NoTunnelValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponse_NoTunnelValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponse_NoTunnelValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponse_NoTunnelValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponse_NoTunnelValidationError) ErrorName() string {
	return "GatewayKasResponse_NoTunnelValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponse_NoTunnelValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse_NoTunnel.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponse_NoTunnelValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponse_NoTunnelValidationError{}

// Validate checks the field values on GatewayKasResponse_Header with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse_Header) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse_Header with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GatewayKasResponse_HeaderMultiError, or nil if none found.
func (m *GatewayKasResponse_Header) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse_Header) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	{
		sorted_keys := make([]string, len(m.GetMeta()))
		i := 0
		for key := range m.GetMeta() {
			sorted_keys[i] = key
			i++
		}
		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
		for _, key := range sorted_keys {
			val := m.GetMeta()[key]
			_ = val

			// no validation rules for Meta[key]

			if all {
				switch v := interface{}(val).(type) {
				case interface{ ValidateAll() error }:
					if err := v.ValidateAll(); err != nil {
						errors = append(errors, GatewayKasResponse_HeaderValidationError{
							field:  fmt.Sprintf("Meta[%v]", key),
							reason: "embedded message failed validation",
							cause:  err,
						})
					}
				case interface{ Validate() error }:
					if err := v.Validate(); err != nil {
						errors = append(errors, GatewayKasResponse_HeaderValidationError{
							field:  fmt.Sprintf("Meta[%v]", key),
							reason: "embedded message failed validation",
							cause:  err,
						})
					}
				}
			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
				if err := v.Validate(); err != nil {
					return GatewayKasResponse_HeaderValidationError{
						field:  fmt.Sprintf("Meta[%v]", key),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}

		}
	}

	if len(errors) > 0 {
		return GatewayKasResponse_HeaderMultiError(errors)
	}

	return nil
}

// GatewayKasResponse_HeaderMultiError is an error wrapping multiple validation
// errors returned by GatewayKasResponse_Header.ValidateAll() if the
// designated constraints aren't met.
type GatewayKasResponse_HeaderMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponse_HeaderMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponse_HeaderMultiError) AllErrors() []error { return m }

// GatewayKasResponse_HeaderValidationError is the validation error returned by
// GatewayKasResponse_Header.Validate if the designated constraints aren't met.
type GatewayKasResponse_HeaderValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponse_HeaderValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponse_HeaderValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponse_HeaderValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponse_HeaderValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponse_HeaderValidationError) ErrorName() string {
	return "GatewayKasResponse_HeaderValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponse_HeaderValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse_Header.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponse_HeaderValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponse_HeaderValidationError{}

// Validate checks the field values on GatewayKasResponse_Message with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse_Message) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse_Message with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GatewayKasResponse_MessageMultiError, or nil if none found.
func (m *GatewayKasResponse_Message) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse_Message) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for Data

	if len(errors) > 0 {
		return GatewayKasResponse_MessageMultiError(errors)
	}

	return nil
}

// GatewayKasResponse_MessageMultiError is an error wrapping multiple
// validation errors returned by GatewayKasResponse_Message.ValidateAll() if
// the designated constraints aren't met.
type GatewayKasResponse_MessageMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponse_MessageMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponse_MessageMultiError) AllErrors() []error { return m }

// GatewayKasResponse_MessageValidationError is the validation error returned
// by GatewayKasResponse_Message.Validate if the designated constraints aren't met.
type GatewayKasResponse_MessageValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponse_MessageValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponse_MessageValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponse_MessageValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponse_MessageValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponse_MessageValidationError) ErrorName() string {
	return "GatewayKasResponse_MessageValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponse_MessageValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse_Message.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponse_MessageValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponse_MessageValidationError{}

// Validate checks the field values on GatewayKasResponse_Trailer with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse_Trailer) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse_Trailer with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GatewayKasResponse_TrailerMultiError, or nil if none found.
func (m *GatewayKasResponse_Trailer) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse_Trailer) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	{
		sorted_keys := make([]string, len(m.GetMeta()))
		i := 0
		for key := range m.GetMeta() {
			sorted_keys[i] = key
			i++
		}
		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
		for _, key := range sorted_keys {
			val := m.GetMeta()[key]
			_ = val

			// no validation rules for Meta[key]

			if all {
				switch v := interface{}(val).(type) {
				case interface{ ValidateAll() error }:
					if err := v.ValidateAll(); err != nil {
						errors = append(errors, GatewayKasResponse_TrailerValidationError{
							field:  fmt.Sprintf("Meta[%v]", key),
							reason: "embedded message failed validation",
							cause:  err,
						})
					}
				case interface{ Validate() error }:
					if err := v.Validate(); err != nil {
						errors = append(errors, GatewayKasResponse_TrailerValidationError{
							field:  fmt.Sprintf("Meta[%v]", key),
							reason: "embedded message failed validation",
							cause:  err,
						})
					}
				}
			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
				if err := v.Validate(); err != nil {
					return GatewayKasResponse_TrailerValidationError{
						field:  fmt.Sprintf("Meta[%v]", key),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}

		}
	}

	if len(errors) > 0 {
		return GatewayKasResponse_TrailerMultiError(errors)
	}

	return nil
}

// GatewayKasResponse_TrailerMultiError is an error wrapping multiple
// validation errors returned by GatewayKasResponse_Trailer.ValidateAll() if
// the designated constraints aren't met.
type GatewayKasResponse_TrailerMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponse_TrailerMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponse_TrailerMultiError) AllErrors() []error { return m }

// GatewayKasResponse_TrailerValidationError is the validation error returned
// by GatewayKasResponse_Trailer.Validate if the designated constraints aren't met.
type GatewayKasResponse_TrailerValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponse_TrailerValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponse_TrailerValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponse_TrailerValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponse_TrailerValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponse_TrailerValidationError) ErrorName() string {
	return "GatewayKasResponse_TrailerValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponse_TrailerValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse_Trailer.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponse_TrailerValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponse_TrailerValidationError{}

// Validate checks the field values on GatewayKasResponse_Error with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GatewayKasResponse_Error) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GatewayKasResponse_Error with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GatewayKasResponse_ErrorMultiError, or nil if none found.
func (m *GatewayKasResponse_Error) ValidateAll() error {
	return m.validate(true)
}

func (m *GatewayKasResponse_Error) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if m.GetStatus() == nil {
		err := GatewayKasResponse_ErrorValidationError{
			field:  "Status",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetStatus()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, GatewayKasResponse_ErrorValidationError{
					field:  "Status",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, GatewayKasResponse_ErrorValidationError{
					field:  "Status",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return GatewayKasResponse_ErrorValidationError{
				field:  "Status",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	if len(errors) > 0 {
		return GatewayKasResponse_ErrorMultiError(errors)
	}

	return nil
}

// GatewayKasResponse_ErrorMultiError is an error wrapping multiple validation
// errors returned by GatewayKasResponse_Error.ValidateAll() if the designated
// constraints aren't met.
type GatewayKasResponse_ErrorMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GatewayKasResponse_ErrorMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GatewayKasResponse_ErrorMultiError) AllErrors() []error { return m }

// GatewayKasResponse_ErrorValidationError is the validation error returned by
// GatewayKasResponse_Error.Validate if the designated constraints aren't met.
type GatewayKasResponse_ErrorValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GatewayKasResponse_ErrorValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GatewayKasResponse_ErrorValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GatewayKasResponse_ErrorValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GatewayKasResponse_ErrorValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GatewayKasResponse_ErrorValidationError) ErrorName() string {
	return "GatewayKasResponse_ErrorValidationError"
}

// Error satisfies the builtin error interface
func (e GatewayKasResponse_ErrorValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGatewayKasResponse_Error.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GatewayKasResponse_ErrorValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GatewayKasResponse_ErrorValidationError{}
