// Copyright AGNTCY Contributors (https://github.com/agntcy)
// SPDX-License-Identifier: Apache-2.0

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: agntcy/dir/store/v1/sync_service.proto

package v1

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.62.0 or later.
const _ = grpc.SupportPackageIsVersion8

const (
	SyncService_CreateSync_FullMethodName                 = "/agntcy.dir.store.v1.SyncService/CreateSync"
	SyncService_ListSyncs_FullMethodName                  = "/agntcy.dir.store.v1.SyncService/ListSyncs"
	SyncService_GetSync_FullMethodName                    = "/agntcy.dir.store.v1.SyncService/GetSync"
	SyncService_DeleteSync_FullMethodName                 = "/agntcy.dir.store.v1.SyncService/DeleteSync"
	SyncService_RequestRegistryCredentials_FullMethodName = "/agntcy.dir.store.v1.SyncService/RequestRegistryCredentials"
)

// SyncServiceClient is the client API for SyncService 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.
//
// SyncService provides functionality for synchronizing objects between Directory nodes.
//
// This service enables one-way synchronization from a remote Directory node to the local node,
// allowing distributed Directory instances to share and replicate objects. The service supports
// both on-demand synchronization and tracking of sync operations through their lifecycle.
type SyncServiceClient interface {
	// CreateSync initiates a new synchronization operation from a remote Directory node.
	//
	// The operation is non-blocking and returns immediately with a sync ID that can be used
	// to track progress and manage the sync operation.
	CreateSync(ctx context.Context, in *CreateSyncRequest, opts ...grpc.CallOption) (*CreateSyncResponse, error)
	// ListSyncs returns a stream of all sync operations known to the system.
	//
	// This includes active, completed, and failed synchronizations.
	ListSyncs(ctx context.Context, in *ListSyncsRequest, opts ...grpc.CallOption) (SyncService_ListSyncsClient, error)
	// GetSync retrieves detailed status information for a specific synchronization.
	GetSync(ctx context.Context, in *GetSyncRequest, opts ...grpc.CallOption) (*GetSyncResponse, error)
	// DeleteSync removes a synchronization operation from the system.
	DeleteSync(ctx context.Context, in *DeleteSyncRequest, opts ...grpc.CallOption) (*DeleteSyncResponse, error)
	// RequestRegistryCredentials requests registry credentials between two Directory nodes.
	//
	// This RPC allows a requesting node to authenticate with this node and obtain
	// temporary registry credentials for secure Zot-based synchronization.
	RequestRegistryCredentials(ctx context.Context, in *RequestRegistryCredentialsRequest, opts ...grpc.CallOption) (*RequestRegistryCredentialsResponse, error)
}

type syncServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewSyncServiceClient(cc grpc.ClientConnInterface) SyncServiceClient {
	return &syncServiceClient{cc}
}

func (c *syncServiceClient) CreateSync(ctx context.Context, in *CreateSyncRequest, opts ...grpc.CallOption) (*CreateSyncResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CreateSyncResponse)
	err := c.cc.Invoke(ctx, SyncService_CreateSync_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *syncServiceClient) ListSyncs(ctx context.Context, in *ListSyncsRequest, opts ...grpc.CallOption) (SyncService_ListSyncsClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &SyncService_ServiceDesc.Streams[0], SyncService_ListSyncs_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &syncServiceListSyncsClient{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
}

type SyncService_ListSyncsClient interface {
	Recv() (*ListSyncsItem, error)
	grpc.ClientStream
}

type syncServiceListSyncsClient struct {
	grpc.ClientStream
}

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

func (c *syncServiceClient) GetSync(ctx context.Context, in *GetSyncRequest, opts ...grpc.CallOption) (*GetSyncResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetSyncResponse)
	err := c.cc.Invoke(ctx, SyncService_GetSync_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *syncServiceClient) DeleteSync(ctx context.Context, in *DeleteSyncRequest, opts ...grpc.CallOption) (*DeleteSyncResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(DeleteSyncResponse)
	err := c.cc.Invoke(ctx, SyncService_DeleteSync_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *syncServiceClient) RequestRegistryCredentials(ctx context.Context, in *RequestRegistryCredentialsRequest, opts ...grpc.CallOption) (*RequestRegistryCredentialsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(RequestRegistryCredentialsResponse)
	err := c.cc.Invoke(ctx, SyncService_RequestRegistryCredentials_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// SyncServiceServer is the server API for SyncService service.
// All implementations should embed UnimplementedSyncServiceServer
// for forward compatibility.
//
// SyncService provides functionality for synchronizing objects between Directory nodes.
//
// This service enables one-way synchronization from a remote Directory node to the local node,
// allowing distributed Directory instances to share and replicate objects. The service supports
// both on-demand synchronization and tracking of sync operations through their lifecycle.
type SyncServiceServer interface {
	// CreateSync initiates a new synchronization operation from a remote Directory node.
	//
	// The operation is non-blocking and returns immediately with a sync ID that can be used
	// to track progress and manage the sync operation.
	CreateSync(context.Context, *CreateSyncRequest) (*CreateSyncResponse, error)
	// ListSyncs returns a stream of all sync operations known to the system.
	//
	// This includes active, completed, and failed synchronizations.
	ListSyncs(*ListSyncsRequest, SyncService_ListSyncsServer) error
	// GetSync retrieves detailed status information for a specific synchronization.
	GetSync(context.Context, *GetSyncRequest) (*GetSyncResponse, error)
	// DeleteSync removes a synchronization operation from the system.
	DeleteSync(context.Context, *DeleteSyncRequest) (*DeleteSyncResponse, error)
	// RequestRegistryCredentials requests registry credentials between two Directory nodes.
	//
	// This RPC allows a requesting node to authenticate with this node and obtain
	// temporary registry credentials for secure Zot-based synchronization.
	RequestRegistryCredentials(context.Context, *RequestRegistryCredentialsRequest) (*RequestRegistryCredentialsResponse, error)
}

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

func (UnimplementedSyncServiceServer) CreateSync(context.Context, *CreateSyncRequest) (*CreateSyncResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateSync not implemented")
}
func (UnimplementedSyncServiceServer) ListSyncs(*ListSyncsRequest, SyncService_ListSyncsServer) error {
	return status.Errorf(codes.Unimplemented, "method ListSyncs not implemented")
}
func (UnimplementedSyncServiceServer) GetSync(context.Context, *GetSyncRequest) (*GetSyncResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetSync not implemented")
}
func (UnimplementedSyncServiceServer) DeleteSync(context.Context, *DeleteSyncRequest) (*DeleteSyncResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DeleteSync not implemented")
}
func (UnimplementedSyncServiceServer) RequestRegistryCredentials(context.Context, *RequestRegistryCredentialsRequest) (*RequestRegistryCredentialsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RequestRegistryCredentials not implemented")
}
func (UnimplementedSyncServiceServer) testEmbeddedByValue() {}

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

func RegisterSyncServiceServer(s grpc.ServiceRegistrar, srv SyncServiceServer) {
	// If the following call pancis, it indicates UnimplementedSyncServiceServer 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(&SyncService_ServiceDesc, srv)
}

func _SyncService_CreateSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CreateSyncRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SyncServiceServer).CreateSync(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: SyncService_CreateSync_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SyncServiceServer).CreateSync(ctx, req.(*CreateSyncRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _SyncService_ListSyncs_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ListSyncsRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(SyncServiceServer).ListSyncs(m, &syncServiceListSyncsServer{ServerStream: stream})
}

type SyncService_ListSyncsServer interface {
	Send(*ListSyncsItem) error
	grpc.ServerStream
}

type syncServiceListSyncsServer struct {
	grpc.ServerStream
}

func (x *syncServiceListSyncsServer) Send(m *ListSyncsItem) error {
	return x.ServerStream.SendMsg(m)
}

func _SyncService_GetSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetSyncRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SyncServiceServer).GetSync(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: SyncService_GetSync_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SyncServiceServer).GetSync(ctx, req.(*GetSyncRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _SyncService_DeleteSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DeleteSyncRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SyncServiceServer).DeleteSync(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: SyncService_DeleteSync_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SyncServiceServer).DeleteSync(ctx, req.(*DeleteSyncRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _SyncService_RequestRegistryCredentials_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RequestRegistryCredentialsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SyncServiceServer).RequestRegistryCredentials(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: SyncService_RequestRegistryCredentials_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SyncServiceServer).RequestRegistryCredentials(ctx, req.(*RequestRegistryCredentialsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// SyncService_ServiceDesc is the grpc.ServiceDesc for SyncService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SyncService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "agntcy.dir.store.v1.SyncService",
	HandlerType: (*SyncServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateSync",
			Handler:    _SyncService_CreateSync_Handler,
		},
		{
			MethodName: "GetSync",
			Handler:    _SyncService_GetSync_Handler,
		},
		{
			MethodName: "DeleteSync",
			Handler:    _SyncService_DeleteSync_Handler,
		},
		{
			MethodName: "RequestRegistryCredentials",
			Handler:    _SyncService_RequestRegistryCredentials_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListSyncs",
			Handler:       _SyncService_ListSyncs_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "agntcy/dir/store/v1/sync_service.proto",
}
