// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: envoy/data/core/v2alpha/health_check_event.proto

package envoy_data_core_v2alpha

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

	"github.com/golang/protobuf/ptypes"
)

// 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)
	_ = ptypes.DynamicAny{}
)

// define the regex for a UUID once up-front
var _health_check_event_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")

// Validate checks the field values on HealthCheckEvent with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *HealthCheckEvent) Validate() error {
	if m == nil {
		return nil
	}

	if _, ok := HealthCheckerType_name[int32(m.GetHealthCheckerType())]; !ok {
		return HealthCheckEventValidationError{
			field:  "HealthCheckerType",
			reason: "value must be one of the defined enum values",
		}
	}

	if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return HealthCheckEventValidationError{
				field:  "Host",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	if len(m.GetClusterName()) < 1 {
		return HealthCheckEventValidationError{
			field:  "ClusterName",
			reason: "value length must be at least 1 bytes",
		}
	}

	if v, ok := interface{}(m.GetTimestamp()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return HealthCheckEventValidationError{
				field:  "Timestamp",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	switch m.Event.(type) {

	case *HealthCheckEvent_EjectUnhealthyEvent:

		if v, ok := interface{}(m.GetEjectUnhealthyEvent()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HealthCheckEventValidationError{
					field:  "EjectUnhealthyEvent",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *HealthCheckEvent_AddHealthyEvent:

		if v, ok := interface{}(m.GetAddHealthyEvent()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HealthCheckEventValidationError{
					field:  "AddHealthyEvent",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *HealthCheckEvent_HealthCheckFailureEvent:

		if v, ok := interface{}(m.GetHealthCheckFailureEvent()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HealthCheckEventValidationError{
					field:  "HealthCheckFailureEvent",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *HealthCheckEvent_DegradedHealthyHost:

		if v, ok := interface{}(m.GetDegradedHealthyHost()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HealthCheckEventValidationError{
					field:  "DegradedHealthyHost",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *HealthCheckEvent_NoLongerDegradedHost:

		if v, ok := interface{}(m.GetNoLongerDegradedHost()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HealthCheckEventValidationError{
					field:  "NoLongerDegradedHost",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		return HealthCheckEventValidationError{
			field:  "Event",
			reason: "value is required",
		}

	}

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e HealthCheckEventValidationError) 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 %sHealthCheckEvent.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HealthCheckEventValidationError{}

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

// Validate checks the field values on HealthCheckEjectUnhealthy with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *HealthCheckEjectUnhealthy) Validate() error {
	if m == nil {
		return nil
	}

	if _, ok := HealthCheckFailureType_name[int32(m.GetFailureType())]; !ok {
		return HealthCheckEjectUnhealthyValidationError{
			field:  "FailureType",
			reason: "value must be one of the defined enum values",
		}
	}

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e HealthCheckEjectUnhealthyValidationError) 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 %sHealthCheckEjectUnhealthy.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HealthCheckEjectUnhealthyValidationError{}

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

// Validate checks the field values on HealthCheckAddHealthy with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *HealthCheckAddHealthy) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for FirstCheck

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e HealthCheckAddHealthyValidationError) 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 %sHealthCheckAddHealthy.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HealthCheckAddHealthyValidationError{}

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

// Validate checks the field values on HealthCheckFailure with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *HealthCheckFailure) Validate() error {
	if m == nil {
		return nil
	}

	if _, ok := HealthCheckFailureType_name[int32(m.GetFailureType())]; !ok {
		return HealthCheckFailureValidationError{
			field:  "FailureType",
			reason: "value must be one of the defined enum values",
		}
	}

	// no validation rules for FirstCheck

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e HealthCheckFailureValidationError) 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 %sHealthCheckFailure.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HealthCheckFailureValidationError{}

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

// Validate checks the field values on DegradedHealthyHost with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *DegradedHealthyHost) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e DegradedHealthyHostValidationError) 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 %sDegradedHealthyHost.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DegradedHealthyHostValidationError{}

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

// Validate checks the field values on NoLongerDegradedHost with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *NoLongerDegradedHost) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e NoLongerDegradedHostValidationError) 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 %sNoLongerDegradedHost.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = NoLongerDegradedHostValidationError{}

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