// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc             v3.21.12
// source: proto/nezha.proto

package proto

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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	NezhaService_ReportSystemState_FullMethodName = "/proto.NezhaService/ReportSystemState"
	NezhaService_ReportSystemInfo_FullMethodName  = "/proto.NezhaService/ReportSystemInfo"
	NezhaService_RequestTask_FullMethodName       = "/proto.NezhaService/RequestTask"
	NezhaService_IOStream_FullMethodName          = "/proto.NezhaService/IOStream"
	NezhaService_ReportGeoIP_FullMethodName       = "/proto.NezhaService/ReportGeoIP"
	NezhaService_ReportSystemInfo2_FullMethodName = "/proto.NezhaService/ReportSystemInfo2"
)

// NezhaServiceClient is the client API for NezhaService 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 NezhaServiceClient interface {
	ReportSystemState(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[State, Receipt], error)
	ReportSystemInfo(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Receipt, error)
	RequestTask(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TaskResult, Task], error)
	IOStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[IOStreamData, IOStreamData], error)
	ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error)
	ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error)
}

type nezhaServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewNezhaServiceClient(cc grpc.ClientConnInterface) NezhaServiceClient {
	return &nezhaServiceClient{cc}
}

func (c *nezhaServiceClient) ReportSystemState(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[State, Receipt], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[0], NezhaService_ReportSystemState_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[State, Receipt]{ClientStream: stream}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_ReportSystemStateClient = grpc.BidiStreamingClient[State, Receipt]

func (c *nezhaServiceClient) ReportSystemInfo(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Receipt, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(Receipt)
	err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nezhaServiceClient) RequestTask(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TaskResult, Task], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[1], NezhaService_RequestTask_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[TaskResult, Task]{ClientStream: stream}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_RequestTaskClient = grpc.BidiStreamingClient[TaskResult, Task]

func (c *nezhaServiceClient) IOStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[IOStreamData, IOStreamData], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[2], NezhaService_IOStream_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[IOStreamData, IOStreamData]{ClientStream: stream}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_IOStreamClient = grpc.BidiStreamingClient[IOStreamData, IOStreamData]

func (c *nezhaServiceClient) ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GeoIP)
	err := c.cc.Invoke(ctx, NezhaService_ReportGeoIP_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(Uint64Receipt)
	err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo2_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// NezhaServiceServer is the server API for NezhaService service.
// All implementations should embed UnimplementedNezhaServiceServer
// for forward compatibility.
type NezhaServiceServer interface {
	ReportSystemState(grpc.BidiStreamingServer[State, Receipt]) error
	ReportSystemInfo(context.Context, *Host) (*Receipt, error)
	RequestTask(grpc.BidiStreamingServer[TaskResult, Task]) error
	IOStream(grpc.BidiStreamingServer[IOStreamData, IOStreamData]) error
	ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error)
	ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error)
}

// UnimplementedNezhaServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedNezhaServiceServer struct{}

func (UnimplementedNezhaServiceServer) ReportSystemState(grpc.BidiStreamingServer[State, Receipt]) error {
	return status.Error(codes.Unimplemented, "method ReportSystemState not implemented")
}
func (UnimplementedNezhaServiceServer) ReportSystemInfo(context.Context, *Host) (*Receipt, error) {
	return nil, status.Error(codes.Unimplemented, "method ReportSystemInfo not implemented")
}
func (UnimplementedNezhaServiceServer) RequestTask(grpc.BidiStreamingServer[TaskResult, Task]) error {
	return status.Error(codes.Unimplemented, "method RequestTask not implemented")
}
func (UnimplementedNezhaServiceServer) IOStream(grpc.BidiStreamingServer[IOStreamData, IOStreamData]) error {
	return status.Error(codes.Unimplemented, "method IOStream not implemented")
}
func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) {
	return nil, status.Error(codes.Unimplemented, "method ReportGeoIP not implemented")
}
func (UnimplementedNezhaServiceServer) ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error) {
	return nil, status.Error(codes.Unimplemented, "method ReportSystemInfo2 not implemented")
}
func (UnimplementedNezhaServiceServer) testEmbeddedByValue() {}

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

func RegisterNezhaServiceServer(s grpc.ServiceRegistrar, srv NezhaServiceServer) {
	// If the following call panics, it indicates UnimplementedNezhaServiceServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&NezhaService_ServiceDesc, srv)
}

func _NezhaService_ReportSystemState_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(NezhaServiceServer).ReportSystemState(&grpc.GenericServerStream[State, Receipt]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_ReportSystemStateServer = grpc.BidiStreamingServer[State, Receipt]

func _NezhaService_ReportSystemInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Host)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NezhaServiceServer).ReportSystemInfo(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: NezhaService_ReportSystemInfo_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NezhaServiceServer).ReportSystemInfo(ctx, req.(*Host))
	}
	return interceptor(ctx, in, info, handler)
}

func _NezhaService_RequestTask_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(NezhaServiceServer).RequestTask(&grpc.GenericServerStream[TaskResult, Task]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_RequestTaskServer = grpc.BidiStreamingServer[TaskResult, Task]

func _NezhaService_IOStream_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(NezhaServiceServer).IOStream(&grpc.GenericServerStream[IOStreamData, IOStreamData]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_IOStreamServer = grpc.BidiStreamingServer[IOStreamData, IOStreamData]

func _NezhaService_ReportGeoIP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GeoIP)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NezhaServiceServer).ReportGeoIP(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: NezhaService_ReportGeoIP_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NezhaServiceServer).ReportGeoIP(ctx, req.(*GeoIP))
	}
	return interceptor(ctx, in, info, handler)
}

func _NezhaService_ReportSystemInfo2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Host)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NezhaServiceServer).ReportSystemInfo2(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: NezhaService_ReportSystemInfo2_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NezhaServiceServer).ReportSystemInfo2(ctx, req.(*Host))
	}
	return interceptor(ctx, in, info, handler)
}

// NezhaService_ServiceDesc is the grpc.ServiceDesc for NezhaService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var NezhaService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.NezhaService",
	HandlerType: (*NezhaServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ReportSystemInfo",
			Handler:    _NezhaService_ReportSystemInfo_Handler,
		},
		{
			MethodName: "ReportGeoIP",
			Handler:    _NezhaService_ReportGeoIP_Handler,
		},
		{
			MethodName: "ReportSystemInfo2",
			Handler:    _NezhaService_ReportSystemInfo2_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ReportSystemState",
			Handler:       _NezhaService_ReportSystemState_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "RequestTask",
			Handler:       _NezhaService_RequestTask_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "IOStream",
			Handler:       _NezhaService_IOStream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "proto/nezha.proto",
}
