// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.34
// source: net/endtoendtest/testpeer/testproto/protos/testservice.proto

package testproto

import (
	context "context"
	errors "errors"
	drpc1 "github.com/planetscale/vtprotobuf/codec/drpc"
	drpc "storj.io/drpc"
	drpcerr "storj.io/drpc/drpcerr"
)

type drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto struct{}

func (drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto) Marshal(msg drpc.Message) ([]byte, error) {
	return drpc1.Marshal(msg)
}

func (drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto) Unmarshal(buf []byte, msg drpc.Message) error {
	return drpc1.Unmarshal(buf, msg)
}

func (drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
	return drpc1.JSONMarshal(msg)
}

func (drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
	return drpc1.JSONUnmarshal(buf, msg)
}

type DRPCTestClient interface {
	DRPCConn() drpc.Conn

	BiDirectionalStream(ctx context.Context) (DRPCTest_BiDirectionalStreamClient, error)
	ServerStream(ctx context.Context, in *StreamMessage) (DRPCTest_ServerStreamClient, error)
	ClientStream(ctx context.Context) (DRPCTest_ClientStreamClient, error)
	Unary(ctx context.Context, in *StreamMessage) (*StreamMessage, error)
}

type drpcTestClient struct {
	cc drpc.Conn
}

func NewDRPCTestClient(cc drpc.Conn) DRPCTestClient {
	return &drpcTestClient{cc}
}

func (c *drpcTestClient) DRPCConn() drpc.Conn { return c.cc }

func (c *drpcTestClient) BiDirectionalStream(ctx context.Context) (DRPCTest_BiDirectionalStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, "/testService.Test/BiDirectionalStream", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcTest_BiDirectionalStreamClient{stream}
	return x, nil
}

type DRPCTest_BiDirectionalStreamClient interface {
	drpc.Stream
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
}

type drpcTest_BiDirectionalStreamClient struct {
	drpc.Stream
}

func (x *drpcTest_BiDirectionalStreamClient) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcTest_BiDirectionalStreamClient) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

func (x *drpcTest_BiDirectionalStreamClient) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_BiDirectionalStreamClient) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

func (c *drpcTestClient) ServerStream(ctx context.Context, in *StreamMessage) (DRPCTest_ServerStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, "/testService.Test/ServerStream", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcTest_ServerStreamClient{stream}
	if err := x.MsgSend(in, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	if err := x.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type DRPCTest_ServerStreamClient interface {
	drpc.Stream
	Recv() (*StreamMessage, error)
}

type drpcTest_ServerStreamClient struct {
	drpc.Stream
}

func (x *drpcTest_ServerStreamClient) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcTest_ServerStreamClient) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_ServerStreamClient) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

func (c *drpcTestClient) ClientStream(ctx context.Context) (DRPCTest_ClientStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, "/testService.Test/ClientStream", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcTest_ClientStreamClient{stream}
	return x, nil
}

type DRPCTest_ClientStreamClient interface {
	drpc.Stream
	Send(*StreamMessage) error
	CloseAndRecv() (*StreamMessage, error)
}

type drpcTest_ClientStreamClient struct {
	drpc.Stream
}

func (x *drpcTest_ClientStreamClient) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcTest_ClientStreamClient) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

func (x *drpcTest_ClientStreamClient) CloseAndRecv() (*StreamMessage, error) {
	if err := x.CloseSend(); err != nil {
		return nil, err
	}
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_ClientStreamClient) CloseAndRecvMsg(m *StreamMessage) error {
	if err := x.CloseSend(); err != nil {
		return err
	}
	return x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

func (c *drpcTestClient) Unary(ctx context.Context, in *StreamMessage) (*StreamMessage, error) {
	out := new(StreamMessage)
	err := c.cc.Invoke(ctx, "/testService.Test/Unary", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}, in, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}

type DRPCTestServer interface {
	BiDirectionalStream(DRPCTest_BiDirectionalStreamStream) error
	ServerStream(*StreamMessage, DRPCTest_ServerStreamStream) error
	ClientStream(DRPCTest_ClientStreamStream) error
	Unary(context.Context, *StreamMessage) (*StreamMessage, error)
}

type DRPCTestUnimplementedServer struct{}

func (s *DRPCTestUnimplementedServer) BiDirectionalStream(DRPCTest_BiDirectionalStreamStream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

func (s *DRPCTestUnimplementedServer) ServerStream(*StreamMessage, DRPCTest_ServerStreamStream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

func (s *DRPCTestUnimplementedServer) ClientStream(DRPCTest_ClientStreamStream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

func (s *DRPCTestUnimplementedServer) Unary(context.Context, *StreamMessage) (*StreamMessage, error) {
	return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

type DRPCTestDescription struct{}

func (DRPCTestDescription) NumMethods() int { return 4 }

func (DRPCTestDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
	switch n {
	case 0:
		return "/testService.Test/BiDirectionalStream", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCTestServer).
					BiDirectionalStream(
						&drpcTest_BiDirectionalStreamStream{in1.(drpc.Stream)},
					)
			}, DRPCTestServer.BiDirectionalStream, true
	case 1:
		return "/testService.Test/ServerStream", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCTestServer).
					ServerStream(
						in1.(*StreamMessage),
						&drpcTest_ServerStreamStream{in2.(drpc.Stream)},
					)
			}, DRPCTestServer.ServerStream, true
	case 2:
		return "/testService.Test/ClientStream", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCTestServer).
					ClientStream(
						&drpcTest_ClientStreamStream{in1.(drpc.Stream)},
					)
			}, DRPCTestServer.ClientStream, true
	case 3:
		return "/testService.Test/Unary", drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return srv.(DRPCTestServer).
					Unary(
						ctx,
						in1.(*StreamMessage),
					)
			}, DRPCTestServer.Unary, true
	default:
		return "", nil, nil, nil, false
	}
}

func DRPCRegisterTest(mux drpc.Mux, impl DRPCTestServer) error {
	return mux.Register(impl, DRPCTestDescription{})
}

type DRPCTest_BiDirectionalStreamStream interface {
	drpc.Stream
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
}

type drpcTest_BiDirectionalStreamStream struct {
	drpc.Stream
}

func (x *drpcTest_BiDirectionalStreamStream) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

func (x *drpcTest_BiDirectionalStreamStream) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_BiDirectionalStreamStream) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

type DRPCTest_ServerStreamStream interface {
	drpc.Stream
	Send(*StreamMessage) error
}

type drpcTest_ServerStreamStream struct {
	drpc.Stream
}

func (x *drpcTest_ServerStreamStream) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

type DRPCTest_ClientStreamStream interface {
	drpc.Stream
	SendAndClose(*StreamMessage) error
	Recv() (*StreamMessage, error)
}

type drpcTest_ClientStreamStream struct {
	drpc.Stream
}

func (x *drpcTest_ClientStreamStream) SendAndClose(m *StreamMessage) error {
	if err := x.MsgSend(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return err
	}
	return x.CloseSend()
}

func (x *drpcTest_ClientStreamStream) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_ClientStreamStream) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{})
}

type DRPCTest_UnaryStream interface {
	drpc.Stream
	SendAndClose(*StreamMessage) error
}

type drpcTest_UnaryStream struct {
	drpc.Stream
}

func (x *drpcTest_UnaryStream) SendAndClose(m *StreamMessage) error {
	if err := x.MsgSend(m, drpcEncoding_File_net_endtoendtest_testpeer_testproto_protos_testservice_proto{}); err != nil {
		return err
	}
	return x.CloseSend()
}
