// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
// Licensed under the GNU Affero General Public License (AGPL).
// See License.AGPL.txt in the project root for license information.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.20.1
// source: localapp.proto

package api

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

// LocalAppClient is the client API for LocalApp 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 LocalAppClient interface {
	TunnelStatus(ctx context.Context, in *TunnelStatusRequest, opts ...grpc.CallOption) (LocalApp_TunnelStatusClient, error)
	AutoTunnel(ctx context.Context, in *AutoTunnelRequest, opts ...grpc.CallOption) (*AutoTunnelResponse, error)
	ResolveSSHConnection(ctx context.Context, in *ResolveSSHConnectionRequest, opts ...grpc.CallOption) (*ResolveSSHConnectionResponse, error)
}

type localAppClient struct {
	cc grpc.ClientConnInterface
}

func NewLocalAppClient(cc grpc.ClientConnInterface) LocalAppClient {
	return &localAppClient{cc}
}

func (c *localAppClient) TunnelStatus(ctx context.Context, in *TunnelStatusRequest, opts ...grpc.CallOption) (LocalApp_TunnelStatusClient, error) {
	stream, err := c.cc.NewStream(ctx, &LocalApp_ServiceDesc.Streams[0], "/localapp.LocalApp/TunnelStatus", opts...)
	if err != nil {
		return nil, err
	}
	x := &localAppTunnelStatusClient{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 LocalApp_TunnelStatusClient interface {
	Recv() (*TunnelStatusResponse, error)
	grpc.ClientStream
}

type localAppTunnelStatusClient struct {
	grpc.ClientStream
}

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

func (c *localAppClient) AutoTunnel(ctx context.Context, in *AutoTunnelRequest, opts ...grpc.CallOption) (*AutoTunnelResponse, error) {
	out := new(AutoTunnelResponse)
	err := c.cc.Invoke(ctx, "/localapp.LocalApp/AutoTunnel", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *localAppClient) ResolveSSHConnection(ctx context.Context, in *ResolveSSHConnectionRequest, opts ...grpc.CallOption) (*ResolveSSHConnectionResponse, error) {
	out := new(ResolveSSHConnectionResponse)
	err := c.cc.Invoke(ctx, "/localapp.LocalApp/ResolveSSHConnection", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// LocalAppServer is the server API for LocalApp service.
// All implementations must embed UnimplementedLocalAppServer
// for forward compatibility
type LocalAppServer interface {
	TunnelStatus(*TunnelStatusRequest, LocalApp_TunnelStatusServer) error
	AutoTunnel(context.Context, *AutoTunnelRequest) (*AutoTunnelResponse, error)
	ResolveSSHConnection(context.Context, *ResolveSSHConnectionRequest) (*ResolveSSHConnectionResponse, error)
	mustEmbedUnimplementedLocalAppServer()
}

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

func (UnimplementedLocalAppServer) TunnelStatus(*TunnelStatusRequest, LocalApp_TunnelStatusServer) error {
	return status.Errorf(codes.Unimplemented, "method TunnelStatus not implemented")
}
func (UnimplementedLocalAppServer) AutoTunnel(context.Context, *AutoTunnelRequest) (*AutoTunnelResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method AutoTunnel not implemented")
}
func (UnimplementedLocalAppServer) ResolveSSHConnection(context.Context, *ResolveSSHConnectionRequest) (*ResolveSSHConnectionResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ResolveSSHConnection not implemented")
}
func (UnimplementedLocalAppServer) mustEmbedUnimplementedLocalAppServer() {}

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

func RegisterLocalAppServer(s grpc.ServiceRegistrar, srv LocalAppServer) {
	s.RegisterService(&LocalApp_ServiceDesc, srv)
}

func _LocalApp_TunnelStatus_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(TunnelStatusRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(LocalAppServer).TunnelStatus(m, &localAppTunnelStatusServer{stream})
}

type LocalApp_TunnelStatusServer interface {
	Send(*TunnelStatusResponse) error
	grpc.ServerStream
}

type localAppTunnelStatusServer struct {
	grpc.ServerStream
}

func (x *localAppTunnelStatusServer) Send(m *TunnelStatusResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _LocalApp_AutoTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AutoTunnelRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(LocalAppServer).AutoTunnel(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/localapp.LocalApp/AutoTunnel",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(LocalAppServer).AutoTunnel(ctx, req.(*AutoTunnelRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _LocalApp_ResolveSSHConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ResolveSSHConnectionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(LocalAppServer).ResolveSSHConnection(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/localapp.LocalApp/ResolveSSHConnection",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(LocalAppServer).ResolveSSHConnection(ctx, req.(*ResolveSSHConnectionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// LocalApp_ServiceDesc is the grpc.ServiceDesc for LocalApp service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var LocalApp_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "localapp.LocalApp",
	HandlerType: (*LocalAppServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AutoTunnel",
			Handler:    _LocalApp_AutoTunnel_Handler,
		},
		{
			MethodName: "ResolveSSHConnection",
			Handler:    _LocalApp_ResolveSSHConnection_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "TunnelStatus",
			Handler:       _LocalApp_TunnelStatus_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "localapp.proto",
}
