// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.34
// source: test.proto

package pb

import (
	context "context"
	errors "errors"
	proto "google.golang.org/protobuf/proto"
	drpc "storj.io/drpc"
	drpcerr "storj.io/drpc/drpcerr"
)

type drpcEncoding_File_test_proto struct{}

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

func (drpcEncoding_File_test_proto) MarshalAppend(buf []byte, msg drpc.Message) ([]byte, error) {
	return proto.MarshalOptions{}.MarshalAppend(buf, msg.(proto.Message))
}

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

type DRPCTestServiceClient interface {
	DRPCConn() drpc.Conn

	Call(ctx context.Context, in *CallReq) (*CallRsp, error)
	Hello(ctx context.Context, in *CallReq) (*CallRsp, error)
}

type drpcTestServiceClient struct {
	cc drpc.Conn
}

func NewDRPCTestServiceClient(cc drpc.Conn) DRPCTestServiceClient {
	return &drpcTestServiceClient{cc}
}

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

func (c *drpcTestServiceClient) Call(ctx context.Context, in *CallReq) (*CallRsp, error) {
	out := new(CallRsp)
	err := c.cc.Invoke(ctx, "/Test.TestService/Call", drpcEncoding_File_test_proto{}, in, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *drpcTestServiceClient) Hello(ctx context.Context, in *CallReq) (*CallRsp, error) {
	out := new(CallRsp)
	err := c.cc.Invoke(ctx, "/Test.TestService/Hello", drpcEncoding_File_test_proto{}, in, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}

type DRPCTestServiceServer interface {
	Call(context.Context, *CallReq) (*CallRsp, error)
	Hello(context.Context, *CallReq) (*CallRsp, error)
}

type DRPCTestServiceUnimplementedServer struct{}

func (s *DRPCTestServiceUnimplementedServer) Call(context.Context, *CallReq) (*CallRsp, error) {
	return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

func (s *DRPCTestServiceUnimplementedServer) Hello(context.Context, *CallReq) (*CallRsp, error) {
	return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

type DRPCTestServiceDescription struct{}

func (DRPCTestServiceDescription) NumMethods() int { return 2 }

func (DRPCTestServiceDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
	switch n {
	case 0:
		return "/Test.TestService/Call", drpcEncoding_File_test_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return srv.(DRPCTestServiceServer).
					Call(
						ctx,
						in1.(*CallReq),
					)
			}, DRPCTestServiceServer.Call, true
	case 1:
		return "/Test.TestService/Hello", drpcEncoding_File_test_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return srv.(DRPCTestServiceServer).
					Hello(
						ctx,
						in1.(*CallReq),
					)
			}, DRPCTestServiceServer.Hello, true
	default:
		return "", nil, nil, nil, false
	}
}

func DRPCRegisterTestService(mux drpc.Mux, impl DRPCTestServiceServer) error {
	return mux.Register(impl, DRPCTestServiceDescription{})
}

type DRPCTestService_CallStream interface {
	drpc.Stream
	SendAndClose(*CallRsp) error
}

type drpcTestService_CallStream struct {
	drpc.Stream
}

func (x *drpcTestService_CallStream) SendAndClose(m *CallRsp) error {
	if err := x.MsgSend(m, drpcEncoding_File_test_proto{}); err != nil {
		return err
	}
	return x.CloseSend()
}

type DRPCTestService_HelloStream interface {
	drpc.Stream
	SendAndClose(*CallRsp) error
}

type drpcTestService_HelloStream struct {
	drpc.Stream
}

func (x *drpcTestService_HelloStream) SendAndClose(m *CallRsp) error {
	if err := x.MsgSend(m, drpcEncoding_File_test_proto{}); err != nil {
		return err
	}
	return x.CloseSend()
}
