// Copyright (c) 2024 Alibaba Group Holding Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v5.28.3
// source: grpc.proto

package main

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

const (
	HelloGrpc_Hello_FullMethodName       = "/HelloGrpc/Hello"
	HelloGrpc_StreamHello_FullMethodName = "/HelloGrpc/StreamHello"
)

// HelloGrpcClient is the client API for HelloGrpc 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 HelloGrpcClient interface {
	Hello(ctx context.Context, in *Req, opts ...grpc.CallOption) (*Resp, error)
	StreamHello(ctx context.Context, in *Req, opts ...grpc.CallOption) (HelloGrpc_StreamHelloClient, error)
}

type helloGrpcClient struct {
	cc grpc.ClientConnInterface
}

func NewHelloGrpcClient(cc grpc.ClientConnInterface) HelloGrpcClient {
	return &helloGrpcClient{cc}
}

func (c *helloGrpcClient) Hello(ctx context.Context, in *Req, opts ...grpc.CallOption) (*Resp, error) {
	out := new(Resp)
	err := c.cc.Invoke(ctx, HelloGrpc_Hello_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *helloGrpcClient) StreamHello(ctx context.Context, in *Req, opts ...grpc.CallOption) (HelloGrpc_StreamHelloClient, error) {
	stream, err := c.cc.NewStream(ctx, &HelloGrpc_ServiceDesc.Streams[0], HelloGrpc_StreamHello_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &helloGrpcStreamHelloClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type HelloGrpc_StreamHelloClient interface {
	Recv() (*Resp, error)
	grpc.ClientStream
}

type helloGrpcStreamHelloClient struct {
	grpc.ClientStream
}

func (x *helloGrpcStreamHelloClient) Recv() (*Resp, error) {
	m := new(Resp)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// HelloGrpcServer is the server API for HelloGrpc service.
// All implementations must embed UnimplementedHelloGrpcServer
// for forward compatibility
type HelloGrpcServer interface {
	Hello(context.Context, *Req) (*Resp, error)
	StreamHello(*Req, HelloGrpc_StreamHelloServer) error
	mustEmbedUnimplementedHelloGrpcServer()
}

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

func (UnimplementedHelloGrpcServer) Hello(context.Context, *Req) (*Resp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented")
}
func (UnimplementedHelloGrpcServer) StreamHello(*Req, HelloGrpc_StreamHelloServer) error {
	return status.Errorf(codes.Unimplemented, "method StreamHello not implemented")
}
func (UnimplementedHelloGrpcServer) mustEmbedUnimplementedHelloGrpcServer() {}

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

func RegisterHelloGrpcServer(s grpc.ServiceRegistrar, srv HelloGrpcServer) {
	s.RegisterService(&HelloGrpc_ServiceDesc, srv)
}

func _HelloGrpc_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Req)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(HelloGrpcServer).Hello(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: HelloGrpc_Hello_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(HelloGrpcServer).Hello(ctx, req.(*Req))
	}
	return interceptor(ctx, in, info, handler)
}

func _HelloGrpc_StreamHello_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Req)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(HelloGrpcServer).StreamHello(m, &helloGrpcStreamHelloServer{stream})
}

type HelloGrpc_StreamHelloServer interface {
	Send(*Resp) error
	grpc.ServerStream
}

type helloGrpcStreamHelloServer struct {
	grpc.ServerStream
}

func (x *helloGrpcStreamHelloServer) Send(m *Resp) error {
	return x.ServerStream.SendMsg(m)
}

// HelloGrpc_ServiceDesc is the grpc.ServiceDesc for HelloGrpc service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var HelloGrpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "HelloGrpc",
	HandlerType: (*HelloGrpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hello",
			Handler:    _HelloGrpc_Hello_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamHello",
			Handler:       _HelloGrpc_StreamHello_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "grpc.proto",
}
