// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.11.0
// source: github.com/aperturerobotics/bifrost/signaling/rpc/client/config.proto

package signaling_rpc_client

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

	client "github.com/aperturerobotics/bifrost/stream/srpc/client"
	protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
	json "github.com/aperturerobotics/protobuf-go-lite/json"
	backoff "github.com/aperturerobotics/util/backoff"
)

// Config configures a client for the Signaling SRPC service.
type Config struct {
	unknownFields []byte
	// SignalingId is the signaling channel ID.
	// Filters which SignalPeer directives will be handled.
	SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signalingId,omitempty"`
	// PeerId is the local peer id to use for the client.
	// Can be empty to use any local peer.
	PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
	// Client contains srpc.client configuration for the signaling RPC client.
	// The local peer ID is overridden with the peer ID of the looked-up peer.
	Client *client.Config `protobuf:"bytes,3,opt,name=client,proto3" json:"client,omitempty"`
	// ProtocolId overrides the default protocol id for the signaling client.
	// Default: bifrost/signaling
	ProtocolId string `protobuf:"bytes,4,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"`
	// ServiceId overrides the default service id for the signaling client.
	// Default: signaling.rpc.Signaling
	ServiceId string `protobuf:"bytes,5,opt,name=service_id,json=serviceId,proto3" json:"serviceId,omitempty"`
	// Backoff is the backoff config for connecting to the service.
	// If unset, defaults to reasonable defaults.
	Backoff *backoff.Backoff `protobuf:"bytes,6,opt,name=backoff,proto3" json:"backoff,omitempty"`
	// DisableListen disables listening for incoming sessions.
	// If set, we will only call out, not accept incoming sessions.
	// If false, client will emit HandleSignalPeer directives for incoming sessions.
	DisableListen bool `protobuf:"varint,7,opt,name=disable_listen,json=disableListen,proto3" json:"disableListen,omitempty"`
}

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

func (*Config) ProtoMessage() {}

func (x *Config) GetSignalingId() string {
	if x != nil {
		return x.SignalingId
	}
	return ""
}

func (x *Config) GetPeerId() string {
	if x != nil {
		return x.PeerId
	}
	return ""
}

func (x *Config) GetClient() *client.Config {
	if x != nil {
		return x.Client
	}
	return nil
}

func (x *Config) GetProtocolId() string {
	if x != nil {
		return x.ProtocolId
	}
	return ""
}

func (x *Config) GetServiceId() string {
	if x != nil {
		return x.ServiceId
	}
	return ""
}

func (x *Config) GetBackoff() *backoff.Backoff {
	if x != nil {
		return x.Backoff
	}
	return nil
}

func (x *Config) GetDisableListen() bool {
	if x != nil {
		return x.DisableListen
	}
	return false
}

func (m *Config) CloneVT() *Config {
	if m == nil {
		return (*Config)(nil)
	}
	r := new(Config)
	r.SignalingId = m.SignalingId
	r.PeerId = m.PeerId
	r.ProtocolId = m.ProtocolId
	r.ServiceId = m.ServiceId
	r.DisableListen = m.DisableListen
	if rhs := m.Client; rhs != nil {
		r.Client = rhs.CloneVT()
	}
	if rhs := m.Backoff; rhs != nil {
		r.Backoff = rhs.CloneVT()
	}
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

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

func (this *Config) EqualVT(that *Config) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.SignalingId != that.SignalingId {
		return false
	}
	if this.PeerId != that.PeerId {
		return false
	}
	if !this.Client.EqualVT(that.Client) {
		return false
	}
	if this.ProtocolId != that.ProtocolId {
		return false
	}
	if this.ServiceId != that.ServiceId {
		return false
	}
	if !this.Backoff.EqualVT(that.Backoff) {
		return false
	}
	if this.DisableListen != that.DisableListen {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

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

// MarshalProtoJSON marshals the Config message to JSON.
func (x *Config) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.SignalingId != "" || s.HasField("signalingId") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("signalingId")
		s.WriteString(x.SignalingId)
	}
	if x.PeerId != "" || s.HasField("peerId") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("peerId")
		s.WriteString(x.PeerId)
	}
	if x.Client != nil || s.HasField("client") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("client")
		x.Client.MarshalProtoJSON(s.WithField("client"))
	}
	if x.ProtocolId != "" || s.HasField("protocolId") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("protocolId")
		s.WriteString(x.ProtocolId)
	}
	if x.ServiceId != "" || s.HasField("serviceId") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("serviceId")
		s.WriteString(x.ServiceId)
	}
	if x.Backoff != nil || s.HasField("backoff") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("backoff")
		x.Backoff.MarshalProtoJSON(s.WithField("backoff"))
	}
	if x.DisableListen || s.HasField("disableListen") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("disableListen")
		s.WriteBool(x.DisableListen)
	}
	s.WriteObjectEnd()
}

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

// UnmarshalProtoJSON unmarshals the Config message from JSON.
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "signaling_id", "signalingId":
			s.AddField("signaling_id")
			x.SignalingId = s.ReadString()
		case "peer_id", "peerId":
			s.AddField("peer_id")
			x.PeerId = s.ReadString()
		case "client":
			if s.ReadNil() {
				x.Client = nil
				return
			}
			x.Client = &client.Config{}
			x.Client.UnmarshalProtoJSON(s.WithField("client", true))
		case "protocol_id", "protocolId":
			s.AddField("protocol_id")
			x.ProtocolId = s.ReadString()
		case "service_id", "serviceId":
			s.AddField("service_id")
			x.ServiceId = s.ReadString()
		case "backoff":
			if s.ReadNil() {
				x.Backoff = nil
				return
			}
			x.Backoff = &backoff.Backoff{}
			x.Backoff.UnmarshalProtoJSON(s.WithField("backoff", true))
		case "disable_listen", "disableListen":
			s.AddField("disable_listen")
			x.DisableListen = s.ReadBool()
		}
	})
}

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

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

func (m *Config) 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.DisableListen {
		i--
		if m.DisableListen {
			dAtA[i] = 1
		} else {
			dAtA[i] = 0
		}
		i--
		dAtA[i] = 0x38
	}
	if m.Backoff != nil {
		size, err := m.Backoff.MarshalToSizedBufferVT(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
		i--
		dAtA[i] = 0x32
	}
	if len(m.ServiceId) > 0 {
		i -= len(m.ServiceId)
		copy(dAtA[i:], m.ServiceId)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ServiceId)))
		i--
		dAtA[i] = 0x2a
	}
	if len(m.ProtocolId) > 0 {
		i -= len(m.ProtocolId)
		copy(dAtA[i:], m.ProtocolId)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId)))
		i--
		dAtA[i] = 0x22
	}
	if m.Client != nil {
		size, err := m.Client.MarshalToSizedBufferVT(dAtA[:i])
		if err != nil {
			return 0, err
		}
		i -= size
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
		i--
		dAtA[i] = 0x1a
	}
	if len(m.PeerId) > 0 {
		i -= len(m.PeerId)
		copy(dAtA[i:], m.PeerId)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId)))
		i--
		dAtA[i] = 0x12
	}
	if len(m.SignalingId) > 0 {
		i -= len(m.SignalingId)
		copy(dAtA[i:], m.SignalingId)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SignalingId)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *Config) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.SignalingId)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	l = len(m.PeerId)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	if m.Client != nil {
		l = m.Client.SizeVT()
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	l = len(m.ProtocolId)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	l = len(m.ServiceId)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	if m.Backoff != nil {
		l = m.Backoff.SizeVT()
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	if m.DisableListen {
		n += 2
	}
	n += len(m.unknownFields)
	return n
}

func (x *Config) MarshalProtoText() string {
	var sb strings.Builder
	sb.WriteString("Config {")
	if x.SignalingId != "" {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("signaling_id: ")
		sb.WriteString(strconv.Quote(x.SignalingId))
	}
	if x.PeerId != "" {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("peer_id: ")
		sb.WriteString(strconv.Quote(x.PeerId))
	}
	if x.Client != nil {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("client: ")
		sb.WriteString(x.Client.MarshalProtoText())
	}
	if x.ProtocolId != "" {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("protocol_id: ")
		sb.WriteString(strconv.Quote(x.ProtocolId))
	}
	if x.ServiceId != "" {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("service_id: ")
		sb.WriteString(strconv.Quote(x.ServiceId))
	}
	if x.Backoff != nil {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("backoff: ")
		sb.WriteString(x.Backoff.MarshalProtoText())
	}
	if x.DisableListen != false {
		if sb.Len() > 8 {
			sb.WriteString(" ")
		}
		sb.WriteString("disable_listen: ")
		sb.WriteString(strconv.FormatBool(x.DisableListen))
	}
	sb.WriteString("}")
	return sb.String()
}

func (x *Config) String() string {
	return x.MarshalProtoText()
}
func (m *Config) 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: Config: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SignalingId", 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.SignalingId = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field PeerId", 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.PeerId = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Client", 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.Client == nil {
				m.Client = &client.Config{}
			}
			if err := m.Client.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", 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.ProtocolId = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 5:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", 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.ServiceId = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 6:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Backoff", 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.Backoff == nil {
				m.Backoff = &backoff.Backoff{}
			}
			if err := m.Backoff.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 7:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field DisableListen", wireType)
			}
			var v 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++
				v |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.DisableListen = bool(v != 0)
		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
}
