// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v6.33.0
// source: weather.proto

package weather_system

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 (
	WeatherAnalyticsService_StreamWeatherData_FullMethodName = "/weather_system.WeatherAnalyticsService/StreamWeatherData"
	WeatherAnalyticsService_StreamAnalytics_FullMethodName   = "/weather_system.WeatherAnalyticsService/StreamAnalytics"
	WeatherAnalyticsService_GetLastReport_FullMethodName     = "/weather_system.WeatherAnalyticsService/GetLastReport"
	WeatherAnalyticsService_ControlSensor_FullMethodName     = "/weather_system.WeatherAnalyticsService/ControlSensor"
)

// WeatherAnalyticsServiceClient is the client API for WeatherAnalyticsService 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.
//
// 2. Weather Analytics Service (Python) - The central server
type WeatherAnalyticsServiceClient interface {
	// A. Client Streaming (Required: Receive from Sensor)
	// Sensor streams data; the server (Analytics) returns the final stats.
	// Auth note: Token validation will use gRPC Metadata, not this message field.
	StreamWeatherData(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[WeatherData, WeatherStats], error)
	// B. Server Streaming (Required: Send to Dashboard)
	// Dashboard requests (with Empty) a continuous stream of reports.
	StreamAnalytics(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WeatherStats], error)
	// C. Unary RPC (Optional Requirement: Retrieve last report)
	// Dashboard manually requests the last stored stats.
	GetLastReport(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*WeatherStats, error)
	// D. Bidirectional Streaming (Academic addition)
	// Allows the server to send immediate alerts and potentially control the sensor.
	ControlSensor(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AlertMessage, WeatherData], error)
}

type weatherAnalyticsServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewWeatherAnalyticsServiceClient(cc grpc.ClientConnInterface) WeatherAnalyticsServiceClient {
	return &weatherAnalyticsServiceClient{cc}
}

func (c *weatherAnalyticsServiceClient) StreamWeatherData(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[WeatherData, WeatherStats], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &WeatherAnalyticsService_ServiceDesc.Streams[0], WeatherAnalyticsService_StreamWeatherData_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[WeatherData, WeatherStats]{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 WeatherAnalyticsService_StreamWeatherDataClient = grpc.ClientStreamingClient[WeatherData, WeatherStats]

func (c *weatherAnalyticsServiceClient) StreamAnalytics(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WeatherStats], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &WeatherAnalyticsService_ServiceDesc.Streams[1], WeatherAnalyticsService_StreamAnalytics_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[Empty, WeatherStats]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type WeatherAnalyticsService_StreamAnalyticsClient = grpc.ServerStreamingClient[WeatherStats]

func (c *weatherAnalyticsServiceClient) GetLastReport(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*WeatherStats, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(WeatherStats)
	err := c.cc.Invoke(ctx, WeatherAnalyticsService_GetLastReport_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *weatherAnalyticsServiceClient) ControlSensor(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AlertMessage, WeatherData], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &WeatherAnalyticsService_ServiceDesc.Streams[2], WeatherAnalyticsService_ControlSensor_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[AlertMessage, WeatherData]{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 WeatherAnalyticsService_ControlSensorClient = grpc.BidiStreamingClient[AlertMessage, WeatherData]

// WeatherAnalyticsServiceServer is the server API for WeatherAnalyticsService service.
// All implementations must embed UnimplementedWeatherAnalyticsServiceServer
// for forward compatibility.
//
// 2. Weather Analytics Service (Python) - The central server
type WeatherAnalyticsServiceServer interface {
	// A. Client Streaming (Required: Receive from Sensor)
	// Sensor streams data; the server (Analytics) returns the final stats.
	// Auth note: Token validation will use gRPC Metadata, not this message field.
	StreamWeatherData(grpc.ClientStreamingServer[WeatherData, WeatherStats]) error
	// B. Server Streaming (Required: Send to Dashboard)
	// Dashboard requests (with Empty) a continuous stream of reports.
	StreamAnalytics(*Empty, grpc.ServerStreamingServer[WeatherStats]) error
	// C. Unary RPC (Optional Requirement: Retrieve last report)
	// Dashboard manually requests the last stored stats.
	GetLastReport(context.Context, *Empty) (*WeatherStats, error)
	// D. Bidirectional Streaming (Academic addition)
	// Allows the server to send immediate alerts and potentially control the sensor.
	ControlSensor(grpc.BidiStreamingServer[AlertMessage, WeatherData]) error
	mustEmbedUnimplementedWeatherAnalyticsServiceServer()
}

// UnimplementedWeatherAnalyticsServiceServer must 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 UnimplementedWeatherAnalyticsServiceServer struct{}

func (UnimplementedWeatherAnalyticsServiceServer) StreamWeatherData(grpc.ClientStreamingServer[WeatherData, WeatherStats]) error {
	return status.Errorf(codes.Unimplemented, "method StreamWeatherData not implemented")
}
func (UnimplementedWeatherAnalyticsServiceServer) StreamAnalytics(*Empty, grpc.ServerStreamingServer[WeatherStats]) error {
	return status.Errorf(codes.Unimplemented, "method StreamAnalytics not implemented")
}
func (UnimplementedWeatherAnalyticsServiceServer) GetLastReport(context.Context, *Empty) (*WeatherStats, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetLastReport not implemented")
}
func (UnimplementedWeatherAnalyticsServiceServer) ControlSensor(grpc.BidiStreamingServer[AlertMessage, WeatherData]) error {
	return status.Errorf(codes.Unimplemented, "method ControlSensor not implemented")
}
func (UnimplementedWeatherAnalyticsServiceServer) mustEmbedUnimplementedWeatherAnalyticsServiceServer() {
}
func (UnimplementedWeatherAnalyticsServiceServer) testEmbeddedByValue() {}

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

func RegisterWeatherAnalyticsServiceServer(s grpc.ServiceRegistrar, srv WeatherAnalyticsServiceServer) {
	// If the following call pancis, it indicates UnimplementedWeatherAnalyticsServiceServer 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(&WeatherAnalyticsService_ServiceDesc, srv)
}

func _WeatherAnalyticsService_StreamWeatherData_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(WeatherAnalyticsServiceServer).StreamWeatherData(&grpc.GenericServerStream[WeatherData, WeatherStats]{ServerStream: stream})
}

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

func _WeatherAnalyticsService_StreamAnalytics_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Empty)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(WeatherAnalyticsServiceServer).StreamAnalytics(m, &grpc.GenericServerStream[Empty, WeatherStats]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type WeatherAnalyticsService_StreamAnalyticsServer = grpc.ServerStreamingServer[WeatherStats]

func _WeatherAnalyticsService_GetLastReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(WeatherAnalyticsServiceServer).GetLastReport(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: WeatherAnalyticsService_GetLastReport_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(WeatherAnalyticsServiceServer).GetLastReport(ctx, req.(*Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _WeatherAnalyticsService_ControlSensor_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(WeatherAnalyticsServiceServer).ControlSensor(&grpc.GenericServerStream[AlertMessage, WeatherData]{ServerStream: stream})
}

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

// WeatherAnalyticsService_ServiceDesc is the grpc.ServiceDesc for WeatherAnalyticsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WeatherAnalyticsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "weather_system.WeatherAnalyticsService",
	HandlerType: (*WeatherAnalyticsServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetLastReport",
			Handler:    _WeatherAnalyticsService_GetLastReport_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamWeatherData",
			Handler:       _WeatherAnalyticsService_StreamWeatherData_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "StreamAnalytics",
			Handler:       _WeatherAnalyticsService_StreamAnalytics_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ControlSensor",
			Handler:       _WeatherAnalyticsService_ControlSensor_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "weather.proto",
}
