// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v4.25.1
// source: service_gateway.proto

package grpc_pb

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// GatewayClient is the client API for Gateway service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type GatewayClient interface {
	// 发送消息到客户端
	ToClient(ctx context.Context, opts ...grpc.CallOption) (Gateway_ToClientClient, error)
	KickUser(ctx context.Context, in *KickUserReq, opts ...grpc.CallOption) (*KickUserResp, error)
}

type gatewayClient struct {
	cc grpc.ClientConnInterface
}

func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient {
	return &gatewayClient{cc}
}

func (c *gatewayClient) ToClient(ctx context.Context, opts ...grpc.CallOption) (Gateway_ToClientClient, error) {
	stream, err := c.cc.NewStream(ctx, &Gateway_ServiceDesc.Streams[0], "/Gateway/ToClient", opts...)
	if err != nil {
		return nil, err
	}
	x := &gatewayToClientClient{stream}
	return x, nil
}

type Gateway_ToClientClient interface {
	Send(*ToClientReq) error
	CloseAndRecv() (*ToClientResp, error)
	grpc.ClientStream
}

type gatewayToClientClient struct {
	grpc.ClientStream
}

func (x *gatewayToClientClient) Send(m *ToClientReq) error {
	return x.ClientStream.SendMsg(m)
}

func (x *gatewayToClientClient) CloseAndRecv() (*ToClientResp, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(ToClientResp)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *gatewayClient) KickUser(ctx context.Context, in *KickUserReq, opts ...grpc.CallOption) (*KickUserResp, error) {
	out := new(KickUserResp)
	err := c.cc.Invoke(ctx, "/Gateway/KickUser", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// GatewayServer is the server API for Gateway service.
// All implementations must embed UnimplementedGatewayServer
// for forward compatibility
type GatewayServer interface {
	// 发送消息到客户端
	ToClient(Gateway_ToClientServer) error
	KickUser(context.Context, *KickUserReq) (*KickUserResp, error)
	mustEmbedUnimplementedGatewayServer()
}

// UnimplementedGatewayServer must be embedded to have forward compatible implementations.
type UnimplementedGatewayServer struct {
}

func (UnimplementedGatewayServer) ToClient(Gateway_ToClientServer) error {
	return status.Errorf(codes.Unimplemented, "method ToClient not implemented")
}
func (UnimplementedGatewayServer) KickUser(context.Context, *KickUserReq) (*KickUserResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method KickUser not implemented")
}
func (UnimplementedGatewayServer) mustEmbedUnimplementedGatewayServer() {}

// UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GatewayServer will
// result in compilation errors.
type UnsafeGatewayServer interface {
	mustEmbedUnimplementedGatewayServer()
}

func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) {
	s.RegisterService(&Gateway_ServiceDesc, srv)
}

func _Gateway_ToClient_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(GatewayServer).ToClient(&gatewayToClientServer{stream})
}

type Gateway_ToClientServer interface {
	SendAndClose(*ToClientResp) error
	Recv() (*ToClientReq, error)
	grpc.ServerStream
}

type gatewayToClientServer struct {
	grpc.ServerStream
}

func (x *gatewayToClientServer) SendAndClose(m *ToClientResp) error {
	return x.ServerStream.SendMsg(m)
}

func (x *gatewayToClientServer) Recv() (*ToClientReq, error) {
	m := new(ToClientReq)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _Gateway_KickUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(KickUserReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GatewayServer).KickUser(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/Gateway/KickUser",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GatewayServer).KickUser(ctx, req.(*KickUserReq))
	}
	return interceptor(ctx, in, info, handler)
}

// Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Gateway_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Gateway",
	HandlerType: (*GatewayServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "KickUser",
			Handler:    _Gateway_KickUser_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ToClient",
			Handler:       _Gateway_ToClient_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "service_gateway.proto",
}
