// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: header/pb/extended_header.proto

package header_pb

import (
	fmt "fmt"
	io "io"
	math "math"
	math_bits "math/bits"

	da "github.com/celestiaorg/celestia-app/v6/proto/celestia/core/v1/da"
	types "github.com/cometbft/cometbft/proto/tendermint/types"
	proto "github.com/gogo/protobuf/proto"
)

// Reference imports to suppress errors if they are not otherwise used.
var (
	_ = proto.Marshal
	_ = fmt.Errorf
	_ = math.Inf
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

type ExtendedHeader struct {
	Header       *types.Header              `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	Commit       *types.Commit              `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"`
	ValidatorSet *types.ValidatorSet        `protobuf:"bytes,3,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"`
	Dah          *da.DataAvailabilityHeader `protobuf:"bytes,4,opt,name=dah,proto3" json:"dah,omitempty"`
}

func (m *ExtendedHeader) Reset()         { *m = ExtendedHeader{} }
func (m *ExtendedHeader) String() string { return proto.CompactTextString(m) }
func (*ExtendedHeader) ProtoMessage()    {}
func (*ExtendedHeader) Descriptor() ([]byte, []int) {
	return fileDescriptor_370294a9fc09133f, []int{0}
}

func (m *ExtendedHeader) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}

func (m *ExtendedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_ExtendedHeader.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}

func (m *ExtendedHeader) XXX_Merge(src proto.Message) {
	xxx_messageInfo_ExtendedHeader.Merge(m, src)
}

func (m *ExtendedHeader) XXX_Size() int {
	return m.Size()
}

func (m *ExtendedHeader) XXX_DiscardUnknown() {
	xxx_messageInfo_ExtendedHeader.DiscardUnknown(m)
}

var xxx_messageInfo_ExtendedHeader proto.InternalMessageInfo

func (m *ExtendedHeader) GetHeader() *types.Header {
	if m != nil {
		return m.Header
	}
	return nil
}

func (m *ExtendedHeader) GetCommit() *types.Commit {
	if m != nil {
		return m.Commit
	}
	return nil
}

func (m *ExtendedHeader) GetValidatorSet() *types.ValidatorSet {
	if m != nil {
		return m.ValidatorSet
	}
	return nil
}

func (m *ExtendedHeader) GetDah() *da.DataAvailabilityHeader {
	if m != nil {
		return m.Dah
	}
	return nil
}

func init() {
	proto.RegisterType((*ExtendedHeader)(nil), "header.pb.ExtendedHeader")
}

func init() { proto.RegisterFile("header/pb/extended_header.proto", fileDescriptor_370294a9fc09133f) }

var fileDescriptor_370294a9fc09133f = []byte{
	// 268 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x48, 0x4d, 0x4c,
	0x49, 0x2d, 0xd2, 0x2f, 0x48, 0xd2, 0x4f, 0xad, 0x28, 0x49, 0xcd, 0x4b, 0x49, 0x4d, 0x89, 0x87,
	0x08, 0xe9, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x71, 0xc2, 0x78, 0x49, 0x52, 0x32, 0x60, 0xf9,
	0xa2, 0xdc, 0xcc, 0xbc, 0x12, 0xfd, 0x92, 0xca, 0x82, 0xd4, 0x62, 0x08, 0x09, 0x51, 0x28, 0xa5,
	0x80, 0x21, 0x5b, 0x96, 0x98, 0x93, 0x99, 0x92, 0x58, 0x92, 0x0f, 0x35, 0x4a, 0x4a, 0x2b, 0x39,
	0x35, 0x27, 0xb5, 0xb8, 0x24, 0x33, 0x51, 0x3f, 0x05, 0x84, 0x4a, 0x12, 0xe3, 0x13, 0xcb, 0x12,
	0x33, 0x73, 0x12, 0x93, 0x32, 0x73, 0x32, 0x4b, 0x2a, 0x51, 0xac, 0x55, 0xfa, 0xc0, 0xc8, 0xc5,
	0xe7, 0x0a, 0x75, 0x90, 0x07, 0x58, 0x42, 0xc8, 0x80, 0x8b, 0x0d, 0xa2, 0x44, 0x82, 0x51, 0x81,
	0x51, 0x83, 0xdb, 0x48, 0x42, 0x0f, 0x61, 0xa3, 0x1e, 0xc4, 0x25, 0x10, 0x95, 0x41, 0x50, 0x75,
	0x20, 0x1d, 0xc9, 0xf9, 0xb9, 0xb9, 0x99, 0x25, 0x12, 0x4c, 0xb8, 0x74, 0x38, 0x83, 0xe5, 0x83,
	0xa0, 0xea, 0x84, 0x9c, 0xb9, 0x78, 0xe1, 0xae, 0x8e, 0x2f, 0x4e, 0x2d, 0x91, 0x60, 0x06, 0x6b,
	0x94, 0xc3, 0xd4, 0x18, 0x06, 0x53, 0x16, 0x9c, 0x5a, 0x12, 0xc4, 0x53, 0x86, 0xc4, 0x13, 0x32,
	0xe5, 0x62, 0x4e, 0x49, 0xcc, 0x90, 0x60, 0x01, 0x6b, 0x55, 0xd6, 0x83, 0xf9, 0x5a, 0x2f, 0x25,
	0x51, 0xcf, 0x25, 0xb1, 0x24, 0xd1, 0x11, 0xc9, 0xd3, 0x50, 0x07, 0x83, 0xd4, 0x3b, 0x49, 0x9c,
	0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31,
	0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x12, 0x1b, 0x38, 0x4c, 0x8c, 0x01, 0x01,
	0x00, 0x00, 0xff, 0xff, 0x33, 0x74, 0x5f, 0xa8, 0xad, 0x01, 0x00, 0x00,
}

func (m *ExtendedHeader) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *ExtendedHeader) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *ExtendedHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.Dah != nil {
		{
			size, err := m.Dah.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintExtendedHeader(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0x22
	}
	if m.ValidatorSet != nil {
		{
			size, err := m.ValidatorSet.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintExtendedHeader(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0x1a
	}
	if m.Commit != nil {
		{
			size, err := m.Commit.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintExtendedHeader(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0x12
	}
	if m.Header != nil {
		{
			size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintExtendedHeader(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func encodeVarintExtendedHeader(dAtA []byte, offset int, v uint64) int {
	offset -= sovExtendedHeader(v)
	base := offset
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return base
}

func (m *ExtendedHeader) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if m.Header != nil {
		l = m.Header.Size()
		n += 1 + l + sovExtendedHeader(uint64(l))
	}
	if m.Commit != nil {
		l = m.Commit.Size()
		n += 1 + l + sovExtendedHeader(uint64(l))
	}
	if m.ValidatorSet != nil {
		l = m.ValidatorSet.Size()
		n += 1 + l + sovExtendedHeader(uint64(l))
	}
	if m.Dah != nil {
		l = m.Dah.Size()
		n += 1 + l + sovExtendedHeader(uint64(l))
	}
	return n
}

func sovExtendedHeader(x uint64) (n int) {
	return (math_bits.Len64(x|1) + 6) / 7
}

func sozExtendedHeader(x uint64) (n int) {
	return sovExtendedHeader(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}

func (m *ExtendedHeader) Unmarshal(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 ErrIntOverflowExtendedHeader
			}
			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: ExtendedHeader: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ExtendedHeader: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowExtendedHeader
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Header == nil {
				m.Header = &types.Header{}
			}
			if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowExtendedHeader
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Commit == nil {
				m.Commit = &types.Commit{}
			}
			if err := m.Commit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSet", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowExtendedHeader
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.ValidatorSet == nil {
				m.ValidatorSet = &types.ValidatorSet{}
			}
			if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Dah", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowExtendedHeader
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Dah == nil {
				m.Dah = &da.DataAvailabilityHeader{}
			}
			if err := m.Dah.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipExtendedHeader(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthExtendedHeader
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

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

func skipExtendedHeader(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	depth := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowExtendedHeader
			}
			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 shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowExtendedHeader
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
		case 1:
			iNdEx += 8
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowExtendedHeader
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if length < 0 {
				return 0, ErrInvalidLengthExtendedHeader
			}
			iNdEx += length
		case 3:
			depth++
		case 4:
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupExtendedHeader
			}
			depth--
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
		if iNdEx < 0 {
			return 0, ErrInvalidLengthExtendedHeader
		}
		if depth == 0 {
			return iNdEx, nil
		}
	}
	return 0, io.ErrUnexpectedEOF
}

var (
	ErrInvalidLengthExtendedHeader        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowExtendedHeader          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupExtendedHeader = fmt.Errorf("proto: unexpected end of group")
)
