// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.35-0.20250513201419-f7819ea69b55
// source: userinfo.proto

package pb

import (
	bytes "bytes"
	context "context"
	errors "errors"

	jsonpb "github.com/gogo/protobuf/jsonpb"
	proto "github.com/gogo/protobuf/proto"

	drpc "storj.io/drpc"
	drpcerr "storj.io/drpc/drpcerr"
)

type drpcEncoding_File_userinfo_proto struct{}

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

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

func (drpcEncoding_File_userinfo_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
	var buf bytes.Buffer
	err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message))
	if err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}

func (drpcEncoding_File_userinfo_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
	return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message))
}

type DRPCUserInfoClient interface {
	DRPCConn() drpc.Conn

	Get(ctx context.Context, in *GetUserInfoRequest) (*GetUserInfoResponse, error)
}

type drpcUserInfoClient struct {
	cc drpc.Conn
}

func NewDRPCUserInfoClient(cc drpc.Conn) DRPCUserInfoClient {
	return &drpcUserInfoClient{cc}
}

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

func (c *drpcUserInfoClient) Get(ctx context.Context, in *GetUserInfoRequest) (*GetUserInfoResponse, error) {
	out := new(GetUserInfoResponse)
	err := c.cc.Invoke(ctx, "/userinfo.UserInfo/Get", drpcEncoding_File_userinfo_proto{}, in, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}

type DRPCUserInfoServer interface {
	Get(context.Context, *GetUserInfoRequest) (*GetUserInfoResponse, error)
}

type DRPCUserInfoUnimplementedServer struct{}

func (s *DRPCUserInfoUnimplementedServer) Get(context.Context, *GetUserInfoRequest) (*GetUserInfoResponse, error) {
	return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

type DRPCUserInfoDescription struct{}

func (DRPCUserInfoDescription) NumMethods() int { return 1 }

func (DRPCUserInfoDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
	switch n {
	case 0:
		return "/userinfo.UserInfo/Get", drpcEncoding_File_userinfo_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return srv.(DRPCUserInfoServer).
					Get(
						ctx,
						in1.(*GetUserInfoRequest),
					)
			}, DRPCUserInfoServer.Get, true
	default:
		return "", nil, nil, nil, false
	}
}

func DRPCRegisterUserInfo(mux drpc.Mux, impl DRPCUserInfoServer) error {
	return mux.Register(impl, DRPCUserInfoDescription{})
}

type DRPCUserInfo_GetStream interface {
	drpc.Stream
	SendAndClose(*GetUserInfoResponse) error
}

type drpcUserInfo_GetStream struct {
	drpc.Stream
}

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

func (x *drpcUserInfo_GetStream) SendAndClose(m *GetUserInfoResponse) error {
	if err := x.MsgSend(m, drpcEncoding_File_userinfo_proto{}); err != nil {
		return err
	}
	return x.CloseSend()
}
