// 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/v0/source.proto

package source

import (
	context "context"
	v0 "github.com/cloudquery/plugin-pb-go/pb/base/v0"
	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_GetProtocolVersion_FullMethodName = "/proto.Source/GetProtocolVersion"
	Source_GetName_FullMethodName            = "/proto.Source/GetName"
	Source_GetVersion_FullMethodName         = "/proto.Source/GetVersion"
	Source_GetTables_FullMethodName          = "/proto.Source/GetTables"
	Source_GetTablesForSpec_FullMethodName   = "/proto.Source/GetTablesForSpec"
	Source_GetSyncSummary_FullMethodName     = "/proto.Source/GetSyncSummary"
	Source_Sync_FullMethodName               = "/proto.Source/Sync"
	Source_Sync2_FullMethodName              = "/proto.Source/Sync2"
	Source_GetMetrics_FullMethodName         = "/proto.Source/GetMetrics"
)

// 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 current protocol version of the plugin. This helps
	// get the right message about upgrade/downgrade of cli and/or plugin.
	// Also, on the cli side it can try to upgrade/downgrade the protocol if cli supports it.
	// Depcrecated: use GetSupportedProtocolVersions instead
	GetProtocolVersion(ctx context.Context, in *v0.GetProtocolVersion_Request, opts ...grpc.CallOption) (*v0.GetProtocolVersion_Response, error)
	// Get the name of the plugin
	GetName(ctx context.Context, in *v0.GetName_Request, opts ...grpc.CallOption) (*v0.GetName_Response, error)
	// Get the current version of the plugin
	GetVersion(ctx context.Context, in *v0.GetVersion_Request, opts ...grpc.CallOption) (*v0.GetVersion_Response, error)
	// Get all tables the source plugin supports
	GetTables(ctx context.Context, in *GetTables_Request, opts ...grpc.CallOption) (*GetTables_Response, error)
	// Get all tables the source plugin supports, optionally filtered by a given spec.
	// Introduced in version 2 of the protocol.
	GetTablesForSpec(ctx context.Context, in *GetTablesForSpec_Request, opts ...grpc.CallOption) (*GetTablesForSpec_Response, error)
	// GetSyncSummary returns the latest sync summary of the source plugin. we don't want to send the summary on
	// every sync request.
	GetSyncSummary(ctx context.Context, in *GetSyncSummary_Request, opts ...grpc.CallOption) (*GetSyncSummary_Response, error)
	// Fetch resources
	Sync(ctx context.Context, in *Sync_Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sync_Response], error)
	// Sync2 is a new sync API that supports CQ Types. It is not backward compatible with Sync.
	Sync2(ctx context.Context, in *Sync2_Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sync2_Response], error)
	// Get metrics for the source plugin
	GetMetrics(ctx context.Context, in *GetSourceMetrics_Request, opts ...grpc.CallOption) (*GetSourceMetrics_Response, error)
}

type sourceClient struct {
	cc grpc.ClientConnInterface
}

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

func (c *sourceClient) GetProtocolVersion(ctx context.Context, in *v0.GetProtocolVersion_Request, opts ...grpc.CallOption) (*v0.GetProtocolVersion_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v0.GetProtocolVersion_Response)
	err := c.cc.Invoke(ctx, Source_GetProtocolVersion_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) GetName(ctx context.Context, in *v0.GetName_Request, opts ...grpc.CallOption) (*v0.GetName_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v0.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 *v0.GetVersion_Request, opts ...grpc.CallOption) (*v0.GetVersion_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v0.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) GetTablesForSpec(ctx context.Context, in *GetTablesForSpec_Request, opts ...grpc.CallOption) (*GetTablesForSpec_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetTablesForSpec_Response)
	err := c.cc.Invoke(ctx, Source_GetTablesForSpec_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sourceClient) GetSyncSummary(ctx context.Context, in *GetSyncSummary_Request, opts ...grpc.CallOption) (*GetSyncSummary_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetSyncSummary_Response)
	err := c.cc.Invoke(ctx, Source_GetSyncSummary_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) Sync2(ctx context.Context, in *Sync2_Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sync2_Response], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Source_ServiceDesc.Streams[1], Source_Sync2_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[Sync2_Request, Sync2_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_Sync2Client = grpc.ServerStreamingClient[Sync2_Response]

func (c *sourceClient) GetMetrics(ctx context.Context, in *GetSourceMetrics_Request, opts ...grpc.CallOption) (*GetSourceMetrics_Response, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetSourceMetrics_Response)
	err := c.cc.Invoke(ctx, Source_GetMetrics_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 current protocol version of the plugin. This helps
	// get the right message about upgrade/downgrade of cli and/or plugin.
	// Also, on the cli side it can try to upgrade/downgrade the protocol if cli supports it.
	// Depcrecated: use GetSupportedProtocolVersions instead
	GetProtocolVersion(context.Context, *v0.GetProtocolVersion_Request) (*v0.GetProtocolVersion_Response, error)
	// Get the name of the plugin
	GetName(context.Context, *v0.GetName_Request) (*v0.GetName_Response, error)
	// Get the current version of the plugin
	GetVersion(context.Context, *v0.GetVersion_Request) (*v0.GetVersion_Response, error)
	// Get all tables the source plugin supports
	GetTables(context.Context, *GetTables_Request) (*GetTables_Response, error)
	// Get all tables the source plugin supports, optionally filtered by a given spec.
	// Introduced in version 2 of the protocol.
	GetTablesForSpec(context.Context, *GetTablesForSpec_Request) (*GetTablesForSpec_Response, error)
	// GetSyncSummary returns the latest sync summary of the source plugin. we don't want to send the summary on
	// every sync request.
	GetSyncSummary(context.Context, *GetSyncSummary_Request) (*GetSyncSummary_Response, error)
	// Fetch resources
	Sync(*Sync_Request, grpc.ServerStreamingServer[Sync_Response]) error
	// Sync2 is a new sync API that supports CQ Types. It is not backward compatible with Sync.
	Sync2(*Sync2_Request, grpc.ServerStreamingServer[Sync2_Response]) error
	// Get metrics for the source plugin
	GetMetrics(context.Context, *GetSourceMetrics_Request) (*GetSourceMetrics_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) GetProtocolVersion(context.Context, *v0.GetProtocolVersion_Request) (*v0.GetProtocolVersion_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetProtocolVersion not implemented")
}
func (UnimplementedSourceServer) GetName(context.Context, *v0.GetName_Request) (*v0.GetName_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetName not implemented")
}
func (UnimplementedSourceServer) GetVersion(context.Context, *v0.GetVersion_Request) (*v0.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) GetTablesForSpec(context.Context, *GetTablesForSpec_Request) (*GetTablesForSpec_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetTablesForSpec not implemented")
}
func (UnimplementedSourceServer) GetSyncSummary(context.Context, *GetSyncSummary_Request) (*GetSyncSummary_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetSyncSummary not implemented")
}
func (UnimplementedSourceServer) Sync(*Sync_Request, grpc.ServerStreamingServer[Sync_Response]) error {
	return status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (UnimplementedSourceServer) Sync2(*Sync2_Request, grpc.ServerStreamingServer[Sync2_Response]) error {
	return status.Errorf(codes.Unimplemented, "method Sync2 not implemented")
}
func (UnimplementedSourceServer) GetMetrics(context.Context, *GetSourceMetrics_Request) (*GetSourceMetrics_Response, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetMetrics 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_GetProtocolVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(v0.GetProtocolVersion_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetProtocolVersion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetProtocolVersion_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetProtocolVersion(ctx, req.(*v0.GetProtocolVersion_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_GetName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(v0.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.(*v0.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(v0.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.(*v0.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_GetTablesForSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetTablesForSpec_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetTablesForSpec(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetTablesForSpec_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetTablesForSpec(ctx, req.(*GetTablesForSpec_Request))
	}
	return interceptor(ctx, in, info, handler)
}

func _Source_GetSyncSummary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetSyncSummary_Request)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SourceServer).GetSyncSummary(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Source_GetSyncSummary_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SourceServer).GetSyncSummary(ctx, req.(*GetSyncSummary_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_Sync2_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Sync2_Request)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(SourceServer).Sync2(m, &grpc.GenericServerStream[Sync2_Request, Sync2_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_Sync2Server = grpc.ServerStreamingServer[Sync2_Response]

func _Source_GetMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetSourceMetrics_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.(*GetSourceMetrics_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: "proto.Source",
	HandlerType: (*SourceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetProtocolVersion",
			Handler:    _Source_GetProtocolVersion_Handler,
		},
		{
			MethodName: "GetName",
			Handler:    _Source_GetName_Handler,
		},
		{
			MethodName: "GetVersion",
			Handler:    _Source_GetVersion_Handler,
		},
		{
			MethodName: "GetTables",
			Handler:    _Source_GetTables_Handler,
		},
		{
			MethodName: "GetTablesForSpec",
			Handler:    _Source_GetTablesForSpec_Handler,
		},
		{
			MethodName: "GetSyncSummary",
			Handler:    _Source_GetSyncSummary_Handler,
		},
		{
			MethodName: "GetMetrics",
			Handler:    _Source_GetMetrics_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Sync",
			Handler:       _Source_Sync_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Sync2",
			Handler:       _Source_Sync2_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "plugin-pb/source/v0/source.proto",
}
