//go:build vtprotobuf
// +build vtprotobuf

// Code generated by protoc-gen-go-vtproto. DO NOT EDIT.
// source: envoy/extensions/geoip_providers/common/v3/common.proto

package commonv3

import (
	protohelpers "github.com/planetscale/vtprotobuf/protohelpers"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)

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

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

func (m *CommonGeoipProviderConfig_GeolocationHeadersToAdd) 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.AnonProxy) > 0 {
		i -= len(m.AnonProxy)
		copy(dAtA[i:], m.AnonProxy)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.AnonProxy)))
		i--
		dAtA[i] = 0x4a
	}
	if len(m.AnonTor) > 0 {
		i -= len(m.AnonTor)
		copy(dAtA[i:], m.AnonTor)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.AnonTor)))
		i--
		dAtA[i] = 0x42
	}
	if len(m.AnonHosting) > 0 {
		i -= len(m.AnonHosting)
		copy(dAtA[i:], m.AnonHosting)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.AnonHosting)))
		i--
		dAtA[i] = 0x3a
	}
	if len(m.AnonVpn) > 0 {
		i -= len(m.AnonVpn)
		copy(dAtA[i:], m.AnonVpn)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.AnonVpn)))
		i--
		dAtA[i] = 0x32
	}
	if len(m.IsAnon) > 0 {
		i -= len(m.IsAnon)
		copy(dAtA[i:], m.IsAnon)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.IsAnon)))
		i--
		dAtA[i] = 0x2a
	}
	if len(m.Asn) > 0 {
		i -= len(m.Asn)
		copy(dAtA[i:], m.Asn)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Asn)))
		i--
		dAtA[i] = 0x22
	}
	if len(m.Region) > 0 {
		i -= len(m.Region)
		copy(dAtA[i:], m.Region)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Region)))
		i--
		dAtA[i] = 0x1a
	}
	if len(m.City) > 0 {
		i -= len(m.City)
		copy(dAtA[i:], m.City)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.City)))
		i--
		dAtA[i] = 0x12
	}
	if len(m.Country) > 0 {
		i -= len(m.Country)
		copy(dAtA[i:], m.Country)
		i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Country)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

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

func (m *CommonGeoipProviderConfig) 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 m.GeoHeadersToAdd != nil {
		size, err := m.GeoHeadersToAdd.MarshalToSizedBufferVTStrict(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
		i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *CommonGeoipProviderConfig_GeolocationHeadersToAdd) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Country)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.City)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.Region)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.Asn)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.IsAnon)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.AnonVpn)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.AnonHosting)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.AnonTor)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	l = len(m.AnonProxy)
	if l > 0 {
		n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
	}
	n += len(m.unknownFields)
	return n
}

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