// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.11.0
// source: github.com/aperturerobotics/controllerbus/example/boilerplate/v1/boilerplate.proto

package boilerplate_v1

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

	protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
	json "github.com/aperturerobotics/protobuf-go-lite/json"
)

// Boilerplate implements the boilerplate directive.
type Boilerplate struct {
	unknownFields []byte
	// MessageText is the message to print with the boilerplate.
	// This is an example field.
	// The keyword "message" prevents us from using that as the field name.
	MessageText string `protobuf:"bytes,1,opt,name=message_text,json=messageText,proto3" json:"messageText,omitempty"`
}

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

func (*Boilerplate) ProtoMessage() {}

func (x *Boilerplate) GetMessageText() string {
	if x != nil {
		return x.MessageText
	}
	return ""
}

// BoilerplateResult implements the boilerplate directive result.
type BoilerplateResult struct {
	unknownFields []byte
	// PrintedLen is the final length of the printed message.
	PrintedLen uint32 `protobuf:"varint,1,opt,name=printed_len,json=printedLen,proto3" json:"printedLen,omitempty"`
}

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

func (*BoilerplateResult) ProtoMessage() {}

func (x *BoilerplateResult) GetPrintedLen() uint32 {
	if x != nil {
		return x.PrintedLen
	}
	return 0
}

func (m *Boilerplate) CloneVT() *Boilerplate {
	if m == nil {
		return (*Boilerplate)(nil)
	}
	r := new(Boilerplate)
	r.MessageText = m.MessageText
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

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

func (m *BoilerplateResult) CloneVT() *BoilerplateResult {
	if m == nil {
		return (*BoilerplateResult)(nil)
	}
	r := new(BoilerplateResult)
	r.PrintedLen = m.PrintedLen
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

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

func (this *Boilerplate) EqualVT(that *Boilerplate) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.MessageText != that.MessageText {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

func (this *Boilerplate) EqualMessageVT(thatMsg any) bool {
	that, ok := thatMsg.(*Boilerplate)
	if !ok {
		return false
	}
	return this.EqualVT(that)
}
func (this *BoilerplateResult) EqualVT(that *BoilerplateResult) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.PrintedLen != that.PrintedLen {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

func (this *BoilerplateResult) EqualMessageVT(thatMsg any) bool {
	that, ok := thatMsg.(*BoilerplateResult)
	if !ok {
		return false
	}
	return this.EqualVT(that)
}

// MarshalProtoJSON marshals the Boilerplate message to JSON.
func (x *Boilerplate) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.MessageText != "" || s.HasField("messageText") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("messageText")
		s.WriteString(x.MessageText)
	}
	s.WriteObjectEnd()
}

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

// UnmarshalProtoJSON unmarshals the Boilerplate message from JSON.
func (x *Boilerplate) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "message_text", "messageText":
			s.AddField("message_text")
			x.MessageText = s.ReadString()
		}
	})
}

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

// MarshalProtoJSON marshals the BoilerplateResult message to JSON.
func (x *BoilerplateResult) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.PrintedLen != 0 || s.HasField("printedLen") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("printedLen")
		s.WriteUint32(x.PrintedLen)
	}
	s.WriteObjectEnd()
}

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

// UnmarshalProtoJSON unmarshals the BoilerplateResult message from JSON.
func (x *BoilerplateResult) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "printed_len", "printedLen":
			s.AddField("printed_len")
			x.PrintedLen = s.ReadUint32()
		}
	})
}

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

func (m *Boilerplate) 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 *Boilerplate) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *Boilerplate) 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 len(m.MessageText) > 0 {
		i -= len(m.MessageText)
		copy(dAtA[i:], m.MessageText)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.MessageText)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *BoilerplateResult) 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 *BoilerplateResult) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *BoilerplateResult) 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 m.PrintedLen != 0 {
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.PrintedLen))
		i--
		dAtA[i] = 0x8
	}
	return len(dAtA) - i, nil
}

func (m *Boilerplate) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.MessageText)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	n += len(m.unknownFields)
	return n
}

func (m *BoilerplateResult) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if m.PrintedLen != 0 {
		n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.PrintedLen))
	}
	n += len(m.unknownFields)
	return n
}

func (x *Boilerplate) MarshalProtoText() string {
	var sb strings.Builder
	sb.WriteString("Boilerplate {")
	if x.MessageText != "" {
		if sb.Len() > 13 {
			sb.WriteString(" ")
		}
		sb.WriteString("message_text: ")
		sb.WriteString(strconv.Quote(x.MessageText))
	}
	sb.WriteString("}")
	return sb.String()
}

func (x *Boilerplate) String() string {
	return x.MarshalProtoText()
}
func (x *BoilerplateResult) MarshalProtoText() string {
	var sb strings.Builder
	sb.WriteString("BoilerplateResult {")
	if x.PrintedLen != 0 {
		if sb.Len() > 19 {
			sb.WriteString(" ")
		}
		sb.WriteString("printed_len: ")
		sb.WriteString(strconv.FormatUint(uint64(x.PrintedLen), 10))
	}
	sb.WriteString("}")
	return sb.String()
}

func (x *BoilerplateResult) String() string {
	return x.MarshalProtoText()
}
func (m *Boilerplate) 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: Boilerplate: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Boilerplate: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field MessageText", 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.MessageText = string(dAtA[iNdEx:postIndex])
			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 *BoilerplateResult) 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: BoilerplateResult: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: BoilerplateResult: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field PrintedLen", wireType)
			}
			m.PrintedLen = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.PrintedLen |= uint32(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		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
}
