// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v6.32.0
// source: ui.proto

package protocol

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 (
	UI_Ping_FullMethodName          = "/protocol.UI/Ping"
	UI_AskRule_FullMethodName       = "/protocol.UI/AskRule"
	UI_Subscribe_FullMethodName     = "/protocol.UI/Subscribe"
	UI_Notifications_FullMethodName = "/protocol.UI/Notifications"
	UI_PostAlert_FullMethodName     = "/protocol.UI/PostAlert"
)

// UIClient is the client API for UI 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 UIClient interface {
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingReply, error)
	AskRule(ctx context.Context, in *Connection, opts ...grpc.CallOption) (*Rule, error)
	Subscribe(ctx context.Context, in *ClientConfig, opts ...grpc.CallOption) (*ClientConfig, error)
	Notifications(ctx context.Context, opts ...grpc.CallOption) (UI_NotificationsClient, error)
	PostAlert(ctx context.Context, in *Alert, opts ...grpc.CallOption) (*MsgResponse, error)
}

type uIClient struct {
	cc grpc.ClientConnInterface
}

func NewUIClient(cc grpc.ClientConnInterface) UIClient {
	return &uIClient{cc}
}

func (c *uIClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingReply, error) {
	out := new(PingReply)
	err := c.cc.Invoke(ctx, UI_Ping_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *uIClient) AskRule(ctx context.Context, in *Connection, opts ...grpc.CallOption) (*Rule, error) {
	out := new(Rule)
	err := c.cc.Invoke(ctx, UI_AskRule_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *uIClient) Subscribe(ctx context.Context, in *ClientConfig, opts ...grpc.CallOption) (*ClientConfig, error) {
	out := new(ClientConfig)
	err := c.cc.Invoke(ctx, UI_Subscribe_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *uIClient) Notifications(ctx context.Context, opts ...grpc.CallOption) (UI_NotificationsClient, error) {
	stream, err := c.cc.NewStream(ctx, &UI_ServiceDesc.Streams[0], UI_Notifications_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &uINotificationsClient{stream}
	return x, nil
}

type UI_NotificationsClient interface {
	Send(*NotificationReply) error
	Recv() (*Notification, error)
	grpc.ClientStream
}

type uINotificationsClient struct {
	grpc.ClientStream
}

func (x *uINotificationsClient) Send(m *NotificationReply) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *uIClient) PostAlert(ctx context.Context, in *Alert, opts ...grpc.CallOption) (*MsgResponse, error) {
	out := new(MsgResponse)
	err := c.cc.Invoke(ctx, UI_PostAlert_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// UIServer is the server API for UI service.
// All implementations must embed UnimplementedUIServer
// for forward compatibility
type UIServer interface {
	Ping(context.Context, *PingRequest) (*PingReply, error)
	AskRule(context.Context, *Connection) (*Rule, error)
	Subscribe(context.Context, *ClientConfig) (*ClientConfig, error)
	Notifications(UI_NotificationsServer) error
	PostAlert(context.Context, *Alert) (*MsgResponse, error)
	mustEmbedUnimplementedUIServer()
}

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

func (UnimplementedUIServer) Ping(context.Context, *PingRequest) (*PingReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedUIServer) AskRule(context.Context, *Connection) (*Rule, error) {
	return nil, status.Errorf(codes.Unimplemented, "method AskRule not implemented")
}
func (UnimplementedUIServer) Subscribe(context.Context, *ClientConfig) (*ClientConfig, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
}
func (UnimplementedUIServer) Notifications(UI_NotificationsServer) error {
	return status.Errorf(codes.Unimplemented, "method Notifications not implemented")
}
func (UnimplementedUIServer) PostAlert(context.Context, *Alert) (*MsgResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PostAlert not implemented")
}
func (UnimplementedUIServer) mustEmbedUnimplementedUIServer() {}

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

func RegisterUIServer(s grpc.ServiceRegistrar, srv UIServer) {
	s.RegisterService(&UI_ServiceDesc, srv)
}

func _UI_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PingRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UIServer).Ping(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: UI_Ping_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UIServer).Ping(ctx, req.(*PingRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UI_AskRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Connection)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UIServer).AskRule(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: UI_AskRule_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UIServer).AskRule(ctx, req.(*Connection))
	}
	return interceptor(ctx, in, info, handler)
}

func _UI_Subscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ClientConfig)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UIServer).Subscribe(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: UI_Subscribe_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UIServer).Subscribe(ctx, req.(*ClientConfig))
	}
	return interceptor(ctx, in, info, handler)
}

func _UI_Notifications_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(UIServer).Notifications(&uINotificationsServer{stream})
}

type UI_NotificationsServer interface {
	Send(*Notification) error
	Recv() (*NotificationReply, error)
	grpc.ServerStream
}

type uINotificationsServer struct {
	grpc.ServerStream
}

func (x *uINotificationsServer) Send(m *Notification) error {
	return x.ServerStream.SendMsg(m)
}

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

func _UI_PostAlert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Alert)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UIServer).PostAlert(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: UI_PostAlert_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UIServer).PostAlert(ctx, req.(*Alert))
	}
	return interceptor(ctx, in, info, handler)
}

// UI_ServiceDesc is the grpc.ServiceDesc for UI service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var UI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "protocol.UI",
	HandlerType: (*UIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Ping",
			Handler:    _UI_Ping_Handler,
		},
		{
			MethodName: "AskRule",
			Handler:    _UI_AskRule_Handler,
		},
		{
			MethodName: "Subscribe",
			Handler:    _UI_Subscribe_Handler,
		},
		{
			MethodName: "PostAlert",
			Handler:    _UI_PostAlert_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Notifications",
			Handler:       _UI_Notifications_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "ui.proto",
}
