package todo

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

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

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{}
)

var _service_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}$")

func (m *ToDo) Validate() error {
	if m == nil {
		return nil
	}

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

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

	return nil
}

type ToDoValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e ToDoValidationError) Field() string { return e.field }

func (e ToDoValidationError) Reason() string { return e.reason }

func (e ToDoValidationError) Cause() error { return e.cause }

func (e ToDoValidationError) Key() bool { return e.key }

func (e ToDoValidationError) ErrorName() string { return "ToDoValidationError" }

func (e ToDoValidationError) 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 %sToDo.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ToDoValidationError{}

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

func (m *ListReq) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

type ListReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e ListReqValidationError) Field() string { return e.field }

func (e ListReqValidationError) Reason() string { return e.reason }

func (e ListReqValidationError) Cause() error { return e.cause }

func (e ListReqValidationError) Key() bool { return e.key }

func (e ListReqValidationError) ErrorName() string { return "ListReqValidationError" }

func (e ListReqValidationError) 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 %sListReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListReqValidationError{}

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

func (m *ListResp) Validate() error {
	if m == nil {
		return nil
	}

	for idx, item := range m.GetItems() {
		_, _ = idx, item

		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return ListRespValidationError{
					field:  fmt.Sprintf("Items[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	return nil
}

type ListRespValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e ListRespValidationError) Field() string { return e.field }

func (e ListRespValidationError) Reason() string { return e.reason }

func (e ListRespValidationError) Cause() error { return e.cause }

func (e ListRespValidationError) Key() bool { return e.key }

func (e ListRespValidationError) ErrorName() string { return "ListRespValidationError" }

func (e ListRespValidationError) 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 %sListResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListRespValidationError{}

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

func (m *GetReq) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

type GetReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e GetReqValidationError) Field() string { return e.field }

func (e GetReqValidationError) Reason() string { return e.reason }

func (e GetReqValidationError) Cause() error { return e.cause }

func (e GetReqValidationError) Key() bool { return e.key }

func (e GetReqValidationError) ErrorName() string { return "GetReqValidationError" }

func (e GetReqValidationError) 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 %sGetReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GetReqValidationError{}

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

func (m *CreateReq) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

type CreateReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e CreateReqValidationError) Field() string { return e.field }

func (e CreateReqValidationError) Reason() string { return e.reason }

func (e CreateReqValidationError) Cause() error { return e.cause }

func (e CreateReqValidationError) Key() bool { return e.key }

func (e CreateReqValidationError) ErrorName() string { return "CreateReqValidationError" }

func (e CreateReqValidationError) 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 %sCreateReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = CreateReqValidationError{}

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

func (m *UpdateReq) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

type UpdateReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e UpdateReqValidationError) Field() string { return e.field }

func (e UpdateReqValidationError) Reason() string { return e.reason }

func (e UpdateReqValidationError) Cause() error { return e.cause }

func (e UpdateReqValidationError) Key() bool { return e.key }

func (e UpdateReqValidationError) ErrorName() string { return "UpdateReqValidationError" }

func (e UpdateReqValidationError) 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 %sUpdateReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = UpdateReqValidationError{}

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

func (m *DeleteReq) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

type DeleteReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e DeleteReqValidationError) Field() string { return e.field }

func (e DeleteReqValidationError) Reason() string { return e.reason }

func (e DeleteReqValidationError) Cause() error { return e.cause }

func (e DeleteReqValidationError) Key() bool { return e.key }

func (e DeleteReqValidationError) ErrorName() string { return "DeleteReqValidationError" }

func (e DeleteReqValidationError) 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 %sDeleteReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DeleteReqValidationError{}

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

func (m *DeleteResp) Validate() error {
	if m == nil {
		return nil
	}

	return nil
}

type DeleteRespValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

func (e DeleteRespValidationError) Field() string { return e.field }

func (e DeleteRespValidationError) Reason() string { return e.reason }

func (e DeleteRespValidationError) Cause() error { return e.cause }

func (e DeleteRespValidationError) Key() bool { return e.key }

func (e DeleteRespValidationError) ErrorName() string { return "DeleteRespValidationError" }

func (e DeleteRespValidationError) 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 %sDeleteResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DeleteRespValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = DeleteRespValidationError{}
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: proto/todo/service.proto

package todo

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 _service_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 ToDo with the rules defined in the proto
// definition for this message. If any rules are violated, an error is returned.
func (m *ToDo) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Id

	// no validation rules for Text

	// no validation rules for Completed

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

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

	return nil
}

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

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

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

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

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

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

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

var _ error = ToDoValidationError{}

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

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

	return nil
}

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

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

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

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

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

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

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

var _ error = ListReqValidationError{}

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

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

	for idx, item := range m.GetItems() {
		_, _ = idx, item

		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return ListRespValidationError{
					field:  fmt.Sprintf("Items[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	return nil
}

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

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

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

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

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

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

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

var _ error = ListRespValidationError{}

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

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

	// no validation rules for Id

	return nil
}

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

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

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

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

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

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

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

var _ error = GetReqValidationError{}

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

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

	// no validation rules for Text

	return nil
}

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

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

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

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

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

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

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

var _ error = CreateReqValidationError{}

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

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

	// no validation rules for Id

	// no validation rules for Text

	// no validation rules for Completed

	return nil
}

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

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

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

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

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

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

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

var _ error = UpdateReqValidationError{}

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

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

	// no validation rules for Id

	return nil
}

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

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

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

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

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

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

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

var _ error = DeleteReqValidationError{}

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

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

	// no validation rules for Result

	return nil
}

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

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

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

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

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

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

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

var _ error = DeleteRespValidationError{}

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