// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.21.12
// source: pkg/service/proto/hwservice.proto

package proto

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// 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

// HWServiceClient is the client API for HWService 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 HWServiceClient interface {
	PollTime(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PollTimeReply, error)
	Sensors(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (HWService_SensorsClient, error)
	ReadingsForSensorID(ctx context.Context, in *SensorIDRequest, opts ...grpc.CallOption) (HWService_ReadingsForSensorIDClient, error)
}

type hWServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewHWServiceClient(cc grpc.ClientConnInterface) HWServiceClient {
	return &hWServiceClient{cc}
}

func (c *hWServiceClient) PollTime(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PollTimeReply, error) {
	out := new(PollTimeReply)
	err := c.cc.Invoke(ctx, "/proto.HWService/PollTime", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *hWServiceClient) Sensors(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (HWService_SensorsClient, error) {
	stream, err := c.cc.NewStream(ctx, &HWService_ServiceDesc.Streams[0], "/proto.HWService/Sensors", opts...)
	if err != nil {
		return nil, err
	}
	x := &hWServiceSensorsClient{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 HWService_SensorsClient interface {
	Recv() (*Sensor, error)
	grpc.ClientStream
}

type hWServiceSensorsClient struct {
	grpc.ClientStream
}

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

func (c *hWServiceClient) ReadingsForSensorID(ctx context.Context, in *SensorIDRequest, opts ...grpc.CallOption) (HWService_ReadingsForSensorIDClient, error) {
	stream, err := c.cc.NewStream(ctx, &HWService_ServiceDesc.Streams[1], "/proto.HWService/ReadingsForSensorID", opts...)
	if err != nil {
		return nil, err
	}
	x := &hWServiceReadingsForSensorIDClient{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 HWService_ReadingsForSensorIDClient interface {
	Recv() (*Reading, error)
	grpc.ClientStream
}

type hWServiceReadingsForSensorIDClient struct {
	grpc.ClientStream
}

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

// HWServiceServer is the server API for HWService service.
// All implementations must embed UnimplementedHWServiceServer
// for forward compatibility
type HWServiceServer interface {
	PollTime(context.Context, *emptypb.Empty) (*PollTimeReply, error)
	Sensors(*emptypb.Empty, HWService_SensorsServer) error
	ReadingsForSensorID(*SensorIDRequest, HWService_ReadingsForSensorIDServer) error
	mustEmbedUnimplementedHWServiceServer()
}

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

func (UnimplementedHWServiceServer) PollTime(context.Context, *emptypb.Empty) (*PollTimeReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PollTime not implemented")
}
func (UnimplementedHWServiceServer) Sensors(*emptypb.Empty, HWService_SensorsServer) error {
	return status.Errorf(codes.Unimplemented, "method Sensors not implemented")
}
func (UnimplementedHWServiceServer) ReadingsForSensorID(*SensorIDRequest, HWService_ReadingsForSensorIDServer) error {
	return status.Errorf(codes.Unimplemented, "method ReadingsForSensorID not implemented")
}
func (UnimplementedHWServiceServer) mustEmbedUnimplementedHWServiceServer() {}

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

func RegisterHWServiceServer(s grpc.ServiceRegistrar, srv HWServiceServer) {
	s.RegisterService(&HWService_ServiceDesc, srv)
}

func _HWService_PollTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(emptypb.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(HWServiceServer).PollTime(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/proto.HWService/PollTime",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(HWServiceServer).PollTime(ctx, req.(*emptypb.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _HWService_Sensors_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(emptypb.Empty)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(HWServiceServer).Sensors(m, &hWServiceSensorsServer{stream})
}

type HWService_SensorsServer interface {
	Send(*Sensor) error
	grpc.ServerStream
}

type hWServiceSensorsServer struct {
	grpc.ServerStream
}

func (x *hWServiceSensorsServer) Send(m *Sensor) error {
	return x.ServerStream.SendMsg(m)
}

func _HWService_ReadingsForSensorID_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(SensorIDRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(HWServiceServer).ReadingsForSensorID(m, &hWServiceReadingsForSensorIDServer{stream})
}

type HWService_ReadingsForSensorIDServer interface {
	Send(*Reading) error
	grpc.ServerStream
}

type hWServiceReadingsForSensorIDServer struct {
	grpc.ServerStream
}

func (x *hWServiceReadingsForSensorIDServer) Send(m *Reading) error {
	return x.ServerStream.SendMsg(m)
}

// HWService_ServiceDesc is the grpc.ServiceDesc for HWService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var HWService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.HWService",
	HandlerType: (*HWServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PollTime",
			Handler:    _HWService_PollTime_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Sensors",
			Handler:       _HWService_Sensors_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ReadingsForSensorID",
			Handler:       _HWService_ReadingsForSensorID_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "pkg/service/proto/hwservice.proto",
}
