// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v4.23.4
// source: plugin-pb/source/v1/source.proto

package source

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 (
	Source_GetName_FullMethodName          = "/cloudquery.source.v1.Source/GetName"
	Source_GetVersion_FullMethodName       = "/cloudquery.source.v1.Source/GetVersion"
	Source_GetTables_FullMethodName        = "/cloudquery.source.v1.Source/GetTables"
	Source_GetMetrics_FullMethodName       = "/cloudquery.source.v1.Source/GetMetrics"
	Source_Init_FullMethodName             = "/cloudquery.source.v1.Source/Init"
	Source_GetDynamicTables_FullMethodName = "/cloudquery.source.v1.Source/GetDynamicTables"
	Source_Sync_FullMethodName             = "/cloudquery.source.v1.Source/Sync"
	Source_GenDocs_FullMethodName          = "/cloudquery.source.v1.Source/GenDocs"
)

// SourceClient is the client API for Source 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 SourceClient interface {
	// Get the name of the plugin
	GetName(ctx context.Context, in *GetName_Request, opts ...grpc.CallOption) (*GetName_Response, error)
	// Get the current version of the plugin
	GetVersion(ctx context.Context, in *GetVersion_Request, opts ...grpc.CallOption) (*GetVersion_Response, error)
	// Get all static tables the source plugin supports
	GetTables(ctx context.Context, in *GetTables_Request, opts ...grpc.CallOption) (*GetTables_Response, error)
	// Get metrics for the source plugin
	GetMetrics(ctx context.Context, in *GetMetrics_Request, opts ...grpc.CallOption) (*GetMetrics_Response, error)
	// Configure the plugin with the given credentials and mode
	Init(ctx context.Context, in *Init_Request, opts ...grpc.CallOption) (*Init_Response, error)
	// Get all tables the source plugin supports. Must be called after Init
	GetDynamicTables(ctx context.Context, in *GetDynamicTables_Request, opts ...grpc.CallOption) (*GetDynamicTables_Response, error)
	// Start the sync the source plugin
	Sync(ctx context.Context, in *Sync_Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sync_Response], error)
	// Generate documentation for the source plugin
	GenDocs(ctx context.Context, in *GenDocs_Request, opts ...grpc.CallOption) (*GenDocs_Response, error)
}

type sourceClient struct {
	cc grpc.ClientConnInterface
}

func NewSourceClient(cc grpc.ClientConnInterface) SourceClient {
	return &sourceClient{cc}
}

func (c *sourceClient) GetName(ctx context.Context, in *GetName_Request, opts ...grpc.CallOption) (*GetName_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetName_Response)
	err := c.cc.Invoke(ctx, Source_GetName_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) GetVersion(ctx context.Context, in *GetVersion_Request, opts ...grpc.CallOption) (*GetVersion_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetVersion_Response)
	err := c.cc.Invoke(ctx, Source_GetVersion_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) GetTables(ctx context.Context, in *GetTables_Request, opts ...grpc.CallOption) (*GetTables_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetTables_Response)
	err := c.cc.Invoke(ctx, Source_GetTables_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) GetMetrics(ctx context.Context, in *GetMetrics_Request, opts ...grpc.CallOption) (*GetMetrics_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetMetrics_Response)
	err := c.cc.Invoke(ctx, Source_GetMetrics_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) Init(ctx context.Context, in *Init_Request, opts ...grpc.CallOption) (*Init_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(Init_Response)
	err := c.cc.Invoke(ctx, Source_Init_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) GetDynamicTables(ctx context.Context, in *GetDynamicTables_Request, opts ...grpc.CallOption) (*GetDynamicTables_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetDynamicTables_Response)
	err := c.cc.Invoke(ctx, Source_GetDynamicTables_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) Sync(ctx context.Context, in *Sync_Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sync_Response], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Source_ServiceDesc.Streams[0], Source_Sync_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[Sync_Request, Sync_Response]{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 Source_SyncClient = grpc.ServerStreamingClient[Sync_Response]

func (c *sourceClient) GenDocs(ctx context.Context, in *GenDocs_Request, opts ...grpc.CallOption) (*GenDocs_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GenDocs_Response)
	err := c.cc.Invoke(ctx, Source_GenDocs_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// SourceServer is the server API for Source service.
// All implementations must embed UnimplementedSourceServer
// for forward compatibility.
type SourceServer interface {
	// Get the name of the plugin
	GetName(context.Context, *GetName_Request) (*GetName_Response, error)
	// Get the current version of the plugin
	GetVersion(context.Context, *GetVersion_Request) (*GetVersion_Response, error)
	// Get all static tables the source plugin supports
	GetTables(context.Context, *GetTables_Request) (*GetTables_Response, error)
	// Get metrics for the source plugin
	GetMetrics(context.Context, *GetMetrics_Request) (*GetMetrics_Response, error)
	// Configure the plugin with the given credentials and mode
	Init(context.Context, *Init_Request) (*Init_Response, error)
	// Get all tables the source plugin supports. Must be called after Init
	GetDynamicTables(context.Context, *GetDynamicTables_Request) (*GetDynamicTables_Response, error)
	// Start the sync the source plugin
	Sync(*Sync_Request, grpc.ServerStreamingServer[Sync_Response]) error
	// Generate documentation for the source plugin
	GenDocs(context.Context, *GenDocs_Request) (*GenDocs_Response, error)
	mustEmbedUnimplementedSourceServer()
}

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

func (UnimplementedSourceServer) GetName(context.Context, *GetName_Request) (*GetName_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetName not implemented")
}
func (UnimplementedSourceServer) GetVersion(context.Context, *GetVersion_Request) (*GetVersion_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetVersion not implemented")
}
func (UnimplementedSourceServer) GetTables(context.Context, *GetTables_Request) (*GetTables_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetTables not implemented")
}
func (UnimplementedSourceServer) GetMetrics(context.Context, *GetMetrics_Request) (*GetMetrics_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetMetrics not implemented")
}
func (UnimplementedSourceServer) Init(context.Context, *Init_Request) (*Init_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Init not implemented")
}
func (UnimplementedSourceServer) GetDynamicTables(context.Context, *GetDynamicTables_Request) (*GetDynamicTables_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetDynamicTables not implemented")
}
func (UnimplementedSourceServer) Sync(*Sync_Request, grpc.ServerStreamingServer[Sync_Response]) error {
	return status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (UnimplementedSourceServer) GenDocs(context.Context, *GenDocs_Request) (*GenDocs_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GenDocs not implemented")
}
func (UnimplementedSourceServer) mustEmbedUnimplementedSourceServer() {}
func (UnimplementedSourceServer) testEmbeddedByValue()                {}

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

func RegisterSourceServer(s grpc.ServiceRegistrar, srv SourceServer) {
	// If the following call pancis, it indicates UnimplementedSourceServer 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(&Source_ServiceDesc, srv)
}

func _Source_GetName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetName_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetName(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetName_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetName(ctx, req.(*GetName_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_GetVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetVersion_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetVersion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetVersion_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetVersion(ctx, req.(*GetVersion_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_GetTables_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetTables_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetTables(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetTables_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetTables(ctx, req.(*GetTables_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_GetMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetMetrics_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetMetrics(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetMetrics_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetMetrics(ctx, req.(*GetMetrics_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Init_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).Init(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_Init_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).Init(ctx, req.(*Init_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_GetDynamicTables_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetDynamicTables_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetDynamicTables(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetDynamicTables_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetDynamicTables(ctx, req.(*GetDynamicTables_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_Sync_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Sync_Request)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(SourceServer).Sync(m, &grpc.GenericServerStream[Sync_Request, Sync_Response]{ServerStream: stream})
}

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

func _Source_GenDocs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GenDocs_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GenDocs(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GenDocs_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GenDocs(ctx, req.(*GenDocs_Request))
	}
	return interceptor(ctx, in, info, handler)
}

// Source_ServiceDesc is the grpc.ServiceDesc for Source service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Source_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cloudquery.source.v1.Source",
	HandlerType: (*SourceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetName",
			Handler:    _Source_GetName_Handler,
		},
		{
			MethodName: "GetVersion",
			Handler:    _Source_GetVersion_Handler,
		},
		{
			MethodName: "GetTables",
			Handler:    _Source_GetTables_Handler,
		},
		{
			MethodName: "GetMetrics",
			Handler:    _Source_GetMetrics_Handler,
		},
		{
			MethodName: "Init",
			Handler:    _Source_Init_Handler,
		},
		{
			MethodName: "GetDynamicTables",
			Handler:    _Source_GetDynamicTables_Handler,
		},
		{
			MethodName: "GenDocs",
			Handler:    _Source_GenDocs_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Sync",
			Handler:       _Source_Sync_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "plugin-pb/source/v1/source.proto",
}
