// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.8.1
// source: github.com/aperturerobotics/protobuf-go-lite/testproto/echo/echo.proto

package echo

import (
	fmt "fmt"
	io "io"
	slices "slices"
	strconv "strconv"
	strings "strings"
	unsafe "unsafe"

	protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
	json "github.com/aperturerobotics/protobuf-go-lite/json"
	_ "github.com/aperturerobotics/protobuf-go-lite/types/known/emptypb"
	timestamppb "github.com/aperturerobotics/protobuf-go-lite/types/known/timestamppb"
)

// ExampleEnum is an example enumeration.
type ExampleEnum int32

const (
	ExampleEnum_UNKNOWN ExampleEnum = 0
	ExampleEnum_FIRST   ExampleEnum = 1
	ExampleEnum_SECOND  ExampleEnum = 2
)

// Enum value maps for ExampleEnum.
var (
	ExampleEnum_name = map[int32]string{
		0: "UNKNOWN",
		1: "FIRST",
		2: "SECOND",
	}
	ExampleEnum_value = map[string]int32{
		"UNKNOWN": 0,
		"FIRST":   1,
		"SECOND":  2,
	}
)

func (x ExampleEnum) Enum() *ExampleEnum {
	p := new(ExampleEnum)
	*p = x
	return p
}

func (x ExampleEnum) String() string {
	name, valid := ExampleEnum_name[int32(x)]
	if valid {
		return name
	}
	return strconv.Itoa(int(x))
}

// EchoMsg is the message body for Echo.
type EchoMsg struct {
	unknownFields []byte
	Body          string                 `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
	Ts            *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=ts,proto3" json:"ts,omitempty"`
	// Types that are assignable to Demo:
	//
	//	*EchoMsg_ExampleEnum
	//	*EchoMsg_ExampleString
	Demo       isEchoMsg_Demo           `protobuf_oneof:"demo"`
	Timestamps []*timestamppb.Timestamp `protobuf:"bytes,5,rep,name=timestamps,proto3" json:"timestamps,omitempty"`
}

func (x *EchoMsg) Reset() {
	*x = EchoMsg{}
}

func (*EchoMsg) ProtoMessage() {}

func (x *EchoMsg) GetBody() string {
	if x != nil {
		return x.Body
	}
	return ""
}

func (x *EchoMsg) GetTs() *timestamppb.Timestamp {
	if x != nil {
		return x.Ts
	}
	return nil
}

func (m *EchoMsg) GetDemo() isEchoMsg_Demo {
	if m != nil {
		return m.Demo
	}
	return nil
}

func (x *EchoMsg) GetExampleEnum() ExampleEnum {
	if x, ok := x.GetDemo().(*EchoMsg_ExampleEnum); ok {
		return x.ExampleEnum
	}
	return ExampleEnum_UNKNOWN
}

func (x *EchoMsg) GetExampleString() string {
	if x, ok := x.GetDemo().(*EchoMsg_ExampleString); ok {
		return x.ExampleString
	}
	return ""
}

func (x *EchoMsg) GetTimestamps() []*timestamppb.Timestamp {
	if x != nil {
		return x.Timestamps
	}
	return nil
}

type isEchoMsg_Demo interface {
	isEchoMsg_Demo()
}

type EchoMsg_ExampleEnum struct {
	ExampleEnum ExampleEnum `protobuf:"varint,3,opt,name=example_enum,json=exampleEnum,proto3,oneof"`
}

type EchoMsg_ExampleString struct {
	ExampleString string `protobuf:"bytes,4,opt,name=example_string,json=exampleString,proto3,oneof"`
}

func (*EchoMsg_ExampleEnum) isEchoMsg_Demo() {}

func (*EchoMsg_ExampleString) isEchoMsg_Demo() {}

func (m *EchoMsg) CloneVT() *EchoMsg {
	if m == nil {
		return (*EchoMsg)(nil)
	}
	r := new(EchoMsg)
	r.Body = m.Body
	if rhs := m.Ts; rhs != nil {
		r.Ts = rhs.CloneVT()
	}
	if m.Demo != nil {
		r.Demo = m.Demo.(interface{ CloneOneofVT() isEchoMsg_Demo }).CloneOneofVT()
	}
	if rhs := m.Timestamps; rhs != nil {
		r.Timestamps = make([]*timestamppb.Timestamp, len(rhs))
		for k, v := range rhs {
			r.Timestamps[k] = v.CloneVT()
		}
	}
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

func (m *EchoMsg) CloneMessageVT() protobuf_go_lite.CloneMessage {
	return m.CloneVT()
}

func (m *EchoMsg_ExampleEnum) CloneVT() *EchoMsg_ExampleEnum {
	if m == nil {
		return (*EchoMsg_ExampleEnum)(nil)
	}
	r := new(EchoMsg_ExampleEnum)
	r.ExampleEnum = m.ExampleEnum
	return r
}

func (m *EchoMsg_ExampleEnum) CloneOneofVT() isEchoMsg_Demo {
	return m.CloneVT()
}

func (m *EchoMsg_ExampleString) CloneVT() *EchoMsg_ExampleString {
	if m == nil {
		return (*EchoMsg_ExampleString)(nil)
	}
	r := new(EchoMsg_ExampleString)
	r.ExampleString = m.ExampleString
	return r
}

func (m *EchoMsg_ExampleString) CloneOneofVT() isEchoMsg_Demo {
	return m.CloneVT()
}

func (this *EchoMsg) EqualVT(that *EchoMsg) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.Demo == nil && that.Demo != nil {
		return false
	} else if this.Demo != nil {
		if that.Demo == nil {
			return false
		}
		if !this.Demo.(interface{ EqualVT(isEchoMsg_Demo) bool }).EqualVT(that.Demo) {
			return false
		}
	}
	if this.Body != that.Body {
		return false
	}
	if !this.Ts.EqualVT(that.Ts) {
		return false
	}
	if len(this.Timestamps) != len(that.Timestamps) {
		return false
	}
	for i, vx := range this.Timestamps {
		vy := that.Timestamps[i]
		if p, q := vx, vy; p != q {
			if p == nil {
				p = &timestamppb.Timestamp{}
			}
			if q == nil {
				q = &timestamppb.Timestamp{}
			}
			if !p.EqualVT(q) {
				return false
			}
		}
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

func (this *EchoMsg) EqualMessageVT(thatMsg any) bool {
	that, ok := thatMsg.(*EchoMsg)
	if !ok {
		return false
	}
	return this.EqualVT(that)
}
func (this *EchoMsg_ExampleEnum) EqualVT(thatIface isEchoMsg_Demo) bool {
	that, ok := thatIface.(*EchoMsg_ExampleEnum)
	if !ok {
		return false
	}
	if this == that {
		return true
	}
	if this == nil && that != nil || this != nil && that == nil {
		return false
	}
	if this.ExampleEnum != that.ExampleEnum {
		return false
	}
	return true
}

func (this *EchoMsg_ExampleString) EqualVT(thatIface isEchoMsg_Demo) bool {
	that, ok := thatIface.(*EchoMsg_ExampleString)
	if !ok {
		return false
	}
	if this == that {
		return true
	}
	if this == nil && that != nil || this != nil && that == nil {
		return false
	}
	if this.ExampleString != that.ExampleString {
		return false
	}
	return true
}

// MarshalProtoJSON marshals the ExampleEnum to JSON.
func (x ExampleEnum) MarshalProtoJSON(s *json.MarshalState) {
	s.WriteEnum(int32(x), ExampleEnum_name)
}

// MarshalText marshals the ExampleEnum to text.
func (x ExampleEnum) MarshalText() ([]byte, error) {
	return []byte(json.GetEnumString(int32(x), ExampleEnum_name)), nil
}

// MarshalJSON marshals the ExampleEnum to JSON.
func (x ExampleEnum) MarshalJSON() ([]byte, error) {
	return json.DefaultMarshalerConfig.Marshal(x)
}

// UnmarshalProtoJSON unmarshals the ExampleEnum from JSON.
func (x *ExampleEnum) UnmarshalProtoJSON(s *json.UnmarshalState) {
	v := s.ReadEnum(ExampleEnum_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read ExampleEnum enum: %v", err)
		return
	}
	*x = ExampleEnum(v)
}

// UnmarshalText unmarshals the ExampleEnum from text.
func (x *ExampleEnum) UnmarshalText(b []byte) error {
	i, err := json.ParseEnumString(string(b), ExampleEnum_value)
	if err != nil {
		return err
	}
	*x = ExampleEnum(i)
	return nil
}

// UnmarshalJSON unmarshals the ExampleEnum from JSON.
func (x *ExampleEnum) UnmarshalJSON(b []byte) error {
	return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}

// MarshalProtoJSON marshals the EchoMsg message to JSON.
func (x *EchoMsg) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.Body != "" || s.HasField("body") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("body")
		s.WriteString(x.Body)
	}
	if x.Ts != nil || s.HasField("ts") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ts")
		x.Ts.MarshalProtoJSON(s.WithField("ts"))
	}
	if x.Demo != nil {
		switch ov := x.Demo.(type) {
		case *EchoMsg_ExampleEnum:
			s.WriteMoreIf(&wroteField)
			s.WriteObjectField("exampleEnum")
			ov.ExampleEnum.MarshalProtoJSON(s)
		case *EchoMsg_ExampleString:
			s.WriteMoreIf(&wroteField)
			s.WriteObjectField("exampleString")
			s.WriteString(ov.ExampleString)
		}
	}
	if len(x.Timestamps) > 0 || s.HasField("timestamps") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("timestamps")
		s.WriteArrayStart()
		var wroteElement bool
		for _, element := range x.Timestamps {
			s.WriteMoreIf(&wroteElement)
			element.MarshalProtoJSON(s.WithField("timestamps"))
		}
		s.WriteArrayEnd()
	}
	s.WriteObjectEnd()
}

// MarshalJSON marshals the EchoMsg to JSON.
func (x *EchoMsg) MarshalJSON() ([]byte, error) {
	return json.DefaultMarshalerConfig.Marshal(x)
}

// UnmarshalProtoJSON unmarshals the EchoMsg message from JSON.
func (x *EchoMsg) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "body":
			s.AddField("body")
			x.Body = s.ReadString()
		case "ts":
			if s.ReadNil() {
				x.Ts = nil
				return
			}
			x.Ts = &timestamppb.Timestamp{}
			x.Ts.UnmarshalProtoJSON(s.WithField("ts", true))
		case "example_enum", "exampleEnum":
			s.AddField("example_enum")
			ov := &EchoMsg_ExampleEnum{}
			x.Demo = ov
			ov.ExampleEnum.UnmarshalProtoJSON(s)
		case "example_string", "exampleString":
			s.AddField("example_string")
			ov := &EchoMsg_ExampleString{}
			x.Demo = ov
			ov.ExampleString = s.ReadString()
		case "timestamps":
			s.AddField("timestamps")
			if s.ReadNil() {
				x.Timestamps = nil
				return
			}
			s.ReadArray(func() {
				if s.ReadNil() {
					x.Timestamps = append(x.Timestamps, nil)
					return
				}
				v := &timestamppb.Timestamp{}
				v.UnmarshalProtoJSON(s.WithField("timestamps", false))
				if s.Err() != nil {
					return
				}
				x.Timestamps = append(x.Timestamps, v)
			})
		}
	})
}

// UnmarshalJSON unmarshals the EchoMsg from JSON.
func (x *EchoMsg) UnmarshalJSON(b []byte) error {
	return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}

func (m *EchoMsg) MarshalVT() (dAtA []byte, err error) {
	if m == nil {
		return nil, nil
	}
	size := m.SizeVT()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBufferVT(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *EchoMsg) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *EchoMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
	if m == nil {
		return 0, nil
	}
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.unknownFields != nil {
		i -= len(m.unknownFields)
		copy(dAtA[i:], m.unknownFields)
	}
	if vtmsg, ok := m.Demo.(interface {
		MarshalToSizedBufferVT([]byte) (int, error)
	}); ok {
		size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
	}
	if len(m.Timestamps) > 0 {
		for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- {
			size, err := m.Timestamps[iNdEx].MarshalToSizedBufferVT(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
			i--
			dAtA[i] = 0x2a
		}
	}
	if m.Ts != nil {
		size, err := m.Ts.MarshalToSizedBufferVT(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
		i--
		dAtA[i] = 0x12
	}
	if len(m.Body) > 0 {
		i -= len(m.Body)
		copy(dAtA[i:], m.Body)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Body)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *EchoMsg_ExampleEnum) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *EchoMsg_ExampleEnum) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
	i := len(dAtA)
	i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ExampleEnum))
	i--
	dAtA[i] = 0x18
	return len(dAtA) - i, nil
}
func (m *EchoMsg_ExampleString) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *EchoMsg_ExampleString) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
	i := len(dAtA)
	i -= len(m.ExampleString)
	copy(dAtA[i:], m.ExampleString)
	i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ExampleString)))
	i--
	dAtA[i] = 0x22
	return len(dAtA) - i, nil
}
func (m *EchoMsg) MarshalVTStrict() (dAtA []byte, err error) {
	if m == nil {
		return nil, nil
	}
	size := m.SizeVT()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *EchoMsg) MarshalToVTStrict(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVTStrict(dAtA[:size])
}

func (m *EchoMsg) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) {
	if m == nil {
		return 0, nil
	}
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.unknownFields != nil {
		i -= len(m.unknownFields)
		copy(dAtA[i:], m.unknownFields)
	}
	if len(m.Timestamps) > 0 {
		for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- {
			size, err := m.Timestamps[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
			i--
			dAtA[i] = 0x2a
		}
	}
	if msg, ok := m.Demo.(*EchoMsg_ExampleString); ok {
		size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
	}
	if msg, ok := m.Demo.(*EchoMsg_ExampleEnum); ok {
		size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
	}
	if m.Ts != nil {
		size, err := m.Ts.MarshalToSizedBufferVTStrict(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
		i--
		dAtA[i] = 0x12
	}
	if len(m.Body) > 0 {
		i -= len(m.Body)
		copy(dAtA[i:], m.Body)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Body)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *EchoMsg_ExampleEnum) MarshalToVTStrict(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVTStrict(dAtA[:size])
}

func (m *EchoMsg_ExampleEnum) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) {
	i := len(dAtA)
	i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ExampleEnum))
	i--
	dAtA[i] = 0x18
	return len(dAtA) - i, nil
}
func (m *EchoMsg_ExampleString) MarshalToVTStrict(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVTStrict(dAtA[:size])
}

func (m *EchoMsg_ExampleString) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) {
	i := len(dAtA)
	i -= len(m.ExampleString)
	copy(dAtA[i:], m.ExampleString)
	i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ExampleString)))
	i--
	dAtA[i] = 0x22
	return len(dAtA) - i, nil
}
func (m *EchoMsg) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Body)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	if m.Ts != nil {
		l = m.Ts.SizeVT()
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	if vtmsg, ok := m.Demo.(interface{ SizeVT() int }); ok {
		n += vtmsg.SizeVT()
	}
	if len(m.Timestamps) > 0 {
		for _, e := range m.Timestamps {
			l = e.SizeVT()
			n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
		}
	}
	n += len(m.unknownFields)
	return n
}

func (m *EchoMsg_ExampleEnum) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.ExampleEnum))
	return n
}
func (m *EchoMsg_ExampleString) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.ExampleString)
	n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	return n
}
func (x ExampleEnum) MarshalProtoText() string {
	return x.String()
}
func (x *EchoMsg) MarshalProtoText() string {
	var sb strings.Builder
	sb.WriteString("EchoMsg {")
	if x.Body != "" {
		if sb.Len() > 9 {
			sb.WriteString(" ")
		}
		sb.WriteString("body: ")
		sb.WriteString(strconv.Quote(x.Body))
	}
	if x.Ts != nil {
		if sb.Len() > 9 {
			sb.WriteString(" ")
		}
		sb.WriteString("ts: ")
		sb.WriteString(x.Ts.MarshalProtoText())
	}
	switch body := x.Demo.(type) {
	case *EchoMsg_ExampleEnum:
		if body.ExampleEnum != 0 {
			if sb.Len() > 9 {
				sb.WriteString(" ")
			}
			sb.WriteString("example_enum: ")
			sb.WriteString("\"")
			sb.WriteString(ExampleEnum(body.ExampleEnum).String())
			sb.WriteString("\"")
		}
	case *EchoMsg_ExampleString:
		if body.ExampleString != "" {
			if sb.Len() > 9 {
				sb.WriteString(" ")
			}
			sb.WriteString("example_string: ")
			sb.WriteString(strconv.Quote(body.ExampleString))
		}
	}
	if len(x.Timestamps) > 0 {
		if sb.Len() > 9 {
			sb.WriteString(" ")
		}
		sb.WriteString("timestamps: [")
		for i, v := range x.Timestamps {
			if i > 0 {
				sb.WriteString(", ")
			}
			sb.WriteString(v.MarshalProtoText())
		}
		sb.WriteString("]")
	}
	sb.WriteString("}")
	return sb.String()
}

func (x *EchoMsg) String() string {
	return x.MarshalProtoText()
}
func (m *EchoMsg) UnmarshalVT(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return protobuf_go_lite.ErrIntOverflow
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: EchoMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: EchoMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Body = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Ts", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Ts == nil {
				m.Ts = &timestamppb.Timestamp{}
			}
			if err := m.Ts.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field ExampleEnum", wireType)
			}
			var v ExampleEnum
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				v |= ExampleEnum(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Demo = &EchoMsg_ExampleEnum{ExampleEnum: v}
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ExampleString", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Demo = &EchoMsg_ExampleString{ExampleString: string(dAtA[iNdEx:postIndex])}
			iNdEx = postIndex
		case 5:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Timestamps", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Timestamps = append(m.Timestamps, &timestamppb.Timestamp{})
			if err := m.Timestamps[len(m.Timestamps)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *EchoMsg) UnmarshalVTUnsafe(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return protobuf_go_lite.ErrIntOverflow
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: EchoMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: EchoMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			var stringValue string
			if intStringLen > 0 {
				stringValue = unsafe.String(&dAtA[iNdEx], intStringLen)
			}
			m.Body = stringValue
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Ts", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Ts == nil {
				m.Ts = &timestamppb.Timestamp{}
			}
			if err := m.Ts.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field ExampleEnum", wireType)
			}
			var v ExampleEnum
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				v |= ExampleEnum(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Demo = &EchoMsg_ExampleEnum{ExampleEnum: v}
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ExampleString", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			var stringValue string
			if intStringLen > 0 {
				stringValue = unsafe.String(&dAtA[iNdEx], intStringLen)
			}
			m.Demo = &EchoMsg_ExampleString{ExampleString: stringValue}
			iNdEx = postIndex
		case 5:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Timestamps", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Timestamps = append(m.Timestamps, &timestamppb.Timestamp{})
			if err := m.Timestamps[len(m.Timestamps)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
