// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.6
// 	protoc        v5.29.3
// source: index/upsidedown/upsidedown.proto

package upsidedown

import (
	fmt "fmt"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	io "io"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

var (
	ErrInvalidLengthUpsidedown = fmt.Errorf("proto: negative length found during unmarshaling")
)

type BackIndexTermsEntry struct {
	state         protoimpl.MessageState `protogen:"open.v1"`
	Field         *uint32                `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
	Terms         []string               `protobuf:"bytes,2,rep,name=terms" json:"terms,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *BackIndexTermsEntry) Reset() {
	*x = BackIndexTermsEntry{}
	mi := &file_index_upsidedown_upsidedown_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *BackIndexTermsEntry) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*BackIndexTermsEntry) ProtoMessage() {}

func (x *BackIndexTermsEntry) ProtoReflect() protoreflect.Message {
	mi := &file_index_upsidedown_upsidedown_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use BackIndexTermsEntry.ProtoReflect.Descriptor instead.
func (*BackIndexTermsEntry) Descriptor() ([]byte, []int) {
	return file_index_upsidedown_upsidedown_proto_rawDescGZIP(), []int{0}
}

func (x *BackIndexTermsEntry) GetField() uint32 {
	if x != nil && x.Field != nil {
		return *x.Field
	}
	return 0
}

func (x *BackIndexTermsEntry) GetTerms() []string {
	if x != nil {
		return x.Terms
	}
	return nil
}

func (x *BackIndexTermsEntry) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if x.Field == nil {
		return 0, fmt.Errorf("missing required `Field`")
	} else {
		data[i] = 0x8
		i++
		i = encodeVarintUpsidedown(data, i, uint64(*x.Field))
	}
	if len(x.Terms) > 0 {
		for _, s := range x.Terms {
			data[i] = 0x12
			i++
			l = len(s)
			for l >= 1<<7 {
				data[i] = uint8(uint64(l)&0x7f | 0x80)
				l >>= 7
				i++
			}
			data[i] = uint8(l)
			i++
			i += copy(data[i:], s)
		}
	}
	return i, nil
}

func (x *BackIndexTermsEntry) Size() (n int) {
	var l int
	_ = l
	if x.Field != nil {
		n += 1 + sovUpsidedown(uint64(*x.Field))
	}
	if len(x.Terms) > 0 {
		for _, s := range x.Terms {
			l = len(s)
			n += 1 + l + sovUpsidedown(uint64(l))
		}
	}
	return n
}

type BackIndexStoreEntry struct {
	state          protoimpl.MessageState `protogen:"open.v1"`
	Field          *uint32                `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
	ArrayPositions []uint64               `protobuf:"varint,2,rep,name=arrayPositions" json:"arrayPositions,omitempty"`
	unknownFields  protoimpl.UnknownFields
	sizeCache      protoimpl.SizeCache
}

func (x *BackIndexStoreEntry) Reset() {
	*x = BackIndexStoreEntry{}
	mi := &file_index_upsidedown_upsidedown_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *BackIndexStoreEntry) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*BackIndexStoreEntry) ProtoMessage() {}

func (x *BackIndexStoreEntry) ProtoReflect() protoreflect.Message {
	mi := &file_index_upsidedown_upsidedown_proto_msgTypes[1]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use BackIndexStoreEntry.ProtoReflect.Descriptor instead.
func (*BackIndexStoreEntry) Descriptor() ([]byte, []int) {
	return file_index_upsidedown_upsidedown_proto_rawDescGZIP(), []int{1}
}

func (x *BackIndexStoreEntry) GetField() uint32 {
	if x != nil && x.Field != nil {
		return *x.Field
	}
	return 0
}

func (x *BackIndexStoreEntry) GetArrayPositions() []uint64 {
	if x != nil {
		return x.ArrayPositions
	}
	return nil
}

func (x *BackIndexStoreEntry) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if x.Field == nil {
		return 0, fmt.Errorf("missing required `Field`")
	} else {
		data[i] = 0x8
		i++
		i = encodeVarintUpsidedown(data, i, uint64(*x.Field))
	}
	if len(x.ArrayPositions) > 0 {
		for _, num := range x.ArrayPositions {
			data[i] = 0x10
			i++
			i = encodeVarintUpsidedown(data, i, uint64(num))
		}
	}
	return i, nil
}

func (x *BackIndexStoreEntry) Size() (n int) {
	var l int
	_ = l
	if x.Field != nil {
		n += 1 + sovUpsidedown(uint64(*x.Field))
	}
	if len(x.ArrayPositions) > 0 {
		for _, e := range x.ArrayPositions {
			n += 1 + sovUpsidedown(uint64(e))
		}
	}
	return n
}

type BackIndexRowValue struct {
	state         protoimpl.MessageState `protogen:"open.v1"`
	TermsEntries  []*BackIndexTermsEntry `protobuf:"bytes,1,rep,name=termsEntries" json:"termsEntries,omitempty"`
	StoredEntries []*BackIndexStoreEntry `protobuf:"bytes,2,rep,name=storedEntries" json:"storedEntries,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *BackIndexRowValue) Reset() {
	*x = BackIndexRowValue{}
	mi := &file_index_upsidedown_upsidedown_proto_msgTypes[2]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *BackIndexRowValue) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*BackIndexRowValue) ProtoMessage() {}

func (x *BackIndexRowValue) ProtoReflect() protoreflect.Message {
	mi := &file_index_upsidedown_upsidedown_proto_msgTypes[2]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use BackIndexRowValue.ProtoReflect.Descriptor instead.
func (*BackIndexRowValue) Descriptor() ([]byte, []int) {
	return file_index_upsidedown_upsidedown_proto_rawDescGZIP(), []int{2}
}

func (x *BackIndexRowValue) GetTermsEntries() []*BackIndexTermsEntry {
	if x != nil {
		return x.TermsEntries
	}
	return nil
}

func (x *BackIndexRowValue) GetStoredEntries() []*BackIndexStoreEntry {
	if x != nil {
		return x.StoredEntries
	}
	return nil
}

func (x *BackIndexRowValue) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(x.TermsEntries) > 0 {
		for _, msg := range x.TermsEntries {
			data[i] = 0xa
			i++
			i = encodeVarintUpsidedown(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	if len(x.StoredEntries) > 0 {
		for _, msg := range x.StoredEntries {
			data[i] = 0x12
			i++
			i = encodeVarintUpsidedown(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	return i, nil
}

func (x *BackIndexRowValue) Size() (n int) {
	var l int
	_ = l
	if len(x.TermsEntries) > 0 {
		for _, e := range x.TermsEntries {
			l = e.Size()
			n += 1 + l + sovUpsidedown(uint64(l))
		}
	}
	if len(x.StoredEntries) > 0 {
		for _, e := range x.StoredEntries {
			l = e.Size()
			n += 1 + l + sovUpsidedown(uint64(l))
		}
	}
	return n
}

func skipUpsidedown(data []byte) (n int, err error) {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for {
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if data[iNdEx-1] < 0x80 {
					break
				}
			}
			return iNdEx, nil
		case 1:
			iNdEx += 8
			return iNdEx, nil
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			iNdEx += length
			if length < 0 {
				return 0, ErrInvalidLengthUpsidedown
			}
			return iNdEx, nil
		case 3:
			for {
				var innerWire uint64
				var start int = iNdEx
				for shift := uint(0); ; shift += 7 {
					if iNdEx >= l {
						return 0, io.ErrUnexpectedEOF
					}
					b := data[iNdEx]
					iNdEx++
					innerWire |= (uint64(b) & 0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				innerWireType := int(innerWire & 0x7)
				if innerWireType == 4 {
					break
				}
				next, err := skipUpsidedown(data[start:])
				if err != nil {
					return 0, err
				}
				iNdEx = start + next
			}
			return iNdEx, nil
		case 4:
			return iNdEx, nil
		case 5:
			iNdEx += 4
			return iNdEx, nil
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
	}
	panic("unreachable")
}

func sovUpsidedown(x uint64) (n int) {
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}

func encodeVarintUpsidedown(data []byte, offset int, v uint64) int {
	for v >= 1<<7 {
		data[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	data[offset] = uint8(v)
	return offset + 1
}

var File_index_upsidedown_upsidedown_proto protoreflect.FileDescriptor

const file_index_upsidedown_upsidedown_proto_rawDesc = "" +
	"\n" +
	"!index/upsidedown/upsidedown.proto\"A\n" +
	"\x13BackIndexTermsEntry\x12\x14\n" +
	"\x05field\x18\x01 \x02(\rR\x05field\x12\x14\n" +
	"\x05terms\x18\x02 \x03(\tR\x05terms\"S\n" +
	"\x13BackIndexStoreEntry\x12\x14\n" +
	"\x05field\x18\x01 \x02(\rR\x05field\x12&\n" +
	"\x0earrayPositions\x18\x02 \x03(\x04R\x0earrayPositions\"\x89\x01\n" +
	"\x11BackIndexRowValue\x128\n" +
	"\ftermsEntries\x18\x01 \x03(\v2\x14.BackIndexTermsEntryR\ftermsEntries\x12:\n" +
	"\rstoredEntries\x18\x02 \x03(\v2\x14.BackIndexStoreEntryR\rstoredEntries"

var (
	file_index_upsidedown_upsidedown_proto_rawDescOnce sync.Once
	file_index_upsidedown_upsidedown_proto_rawDescData []byte
)

func file_index_upsidedown_upsidedown_proto_rawDescGZIP() []byte {
	file_index_upsidedown_upsidedown_proto_rawDescOnce.Do(func() {
		file_index_upsidedown_upsidedown_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_index_upsidedown_upsidedown_proto_rawDesc), len(file_index_upsidedown_upsidedown_proto_rawDesc)))
	})
	return file_index_upsidedown_upsidedown_proto_rawDescData
}

var file_index_upsidedown_upsidedown_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_index_upsidedown_upsidedown_proto_goTypes = []any{
	(*BackIndexTermsEntry)(nil), // 0: BackIndexTermsEntry
	(*BackIndexStoreEntry)(nil), // 1: BackIndexStoreEntry
	(*BackIndexRowValue)(nil),   // 2: BackIndexRowValue
}
var file_index_upsidedown_upsidedown_proto_depIdxs = []int32{
	0, // 0: BackIndexRowValue.termsEntries:type_name -> BackIndexTermsEntry
	1, // 1: BackIndexRowValue.storedEntries:type_name -> BackIndexStoreEntry
	2, // [2:2] is the sub-list for method output_type
	2, // [2:2] is the sub-list for method input_type
	2, // [2:2] is the sub-list for extension type_name
	2, // [2:2] is the sub-list for extension extendee
	0, // [0:2] is the sub-list for field type_name
}

func init() { file_index_upsidedown_upsidedown_proto_init() }
func file_index_upsidedown_upsidedown_proto_init() {
	if File_index_upsidedown_upsidedown_proto != nil {
		return
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_index_upsidedown_upsidedown_proto_rawDesc), len(file_index_upsidedown_upsidedown_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   3,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_index_upsidedown_upsidedown_proto_goTypes,
		DependencyIndexes: file_index_upsidedown_upsidedown_proto_depIdxs,
		MessageInfos:      file_index_upsidedown_upsidedown_proto_msgTypes,
	}.Build()
	File_index_upsidedown_upsidedown_proto = out.File
	file_index_upsidedown_upsidedown_proto_goTypes = nil
	file_index_upsidedown_upsidedown_proto_depIdxs = nil
}
