// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v6.30.2
// source: conflicts.proto

package gitalypb

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 (
	ConflictsService_ListConflictFiles_FullMethodName = "/gitaly.ConflictsService/ListConflictFiles"
	ConflictsService_ResolveConflicts_FullMethodName  = "/gitaly.ConflictsService/ResolveConflicts"
)

// ConflictsServiceClient is the client API for ConflictsService 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.
//
// ConflictsService is a service which provides RPCs to interact with conflicts
// resulting from a merge.
type ConflictsServiceClient interface {
	// ListConflictFiles returns all conflicting files which result from a merge
	// of two specified commit objects.
	ListConflictFiles(ctx context.Context, in *ListConflictFilesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListConflictFilesResponse], error)
	// ResolveConflicts tries to resolve a conflicting merge with a set of
	// user-provided merge resolutions. If resolving the conflict succeeds, the
	// result will be a new merge commit.
	ResolveConflicts(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ResolveConflictsRequest, ResolveConflictsResponse], error)
}

type conflictsServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewConflictsServiceClient(cc grpc.ClientConnInterface) ConflictsServiceClient {
	return &conflictsServiceClient{cc}
}

func (c *conflictsServiceClient) ListConflictFiles(ctx context.Context, in *ListConflictFilesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListConflictFilesResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ConflictsService_ServiceDesc.Streams[0], ConflictsService_ListConflictFiles_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ListConflictFilesRequest, ListConflictFilesResponse]{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 ConflictsService_ListConflictFilesClient = grpc.ServerStreamingClient[ListConflictFilesResponse]

func (c *conflictsServiceClient) ResolveConflicts(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ResolveConflictsRequest, ResolveConflictsResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ConflictsService_ServiceDesc.Streams[1], ConflictsService_ResolveConflicts_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ResolveConflictsRequest, ResolveConflictsResponse]{ClientStream: stream}
	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 ConflictsService_ResolveConflictsClient = grpc.ClientStreamingClient[ResolveConflictsRequest, ResolveConflictsResponse]

// ConflictsServiceServer is the server API for ConflictsService service.
// All implementations must embed UnimplementedConflictsServiceServer
// for forward compatibility.
//
// ConflictsService is a service which provides RPCs to interact with conflicts
// resulting from a merge.
type ConflictsServiceServer interface {
	// ListConflictFiles returns all conflicting files which result from a merge
	// of two specified commit objects.
	ListConflictFiles(*ListConflictFilesRequest, grpc.ServerStreamingServer[ListConflictFilesResponse]) error
	// ResolveConflicts tries to resolve a conflicting merge with a set of
	// user-provided merge resolutions. If resolving the conflict succeeds, the
	// result will be a new merge commit.
	ResolveConflicts(grpc.ClientStreamingServer[ResolveConflictsRequest, ResolveConflictsResponse]) error
	mustEmbedUnimplementedConflictsServiceServer()
}

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

func (UnimplementedConflictsServiceServer) ListConflictFiles(*ListConflictFilesRequest, grpc.ServerStreamingServer[ListConflictFilesResponse]) error {
	return status.Error(codes.Unimplemented, "method ListConflictFiles not implemented")
}
func (UnimplementedConflictsServiceServer) ResolveConflicts(grpc.ClientStreamingServer[ResolveConflictsRequest, ResolveConflictsResponse]) error {
	return status.Error(codes.Unimplemented, "method ResolveConflicts not implemented")
}
func (UnimplementedConflictsServiceServer) mustEmbedUnimplementedConflictsServiceServer() {}
func (UnimplementedConflictsServiceServer) testEmbeddedByValue()                          {}

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

func RegisterConflictsServiceServer(s grpc.ServiceRegistrar, srv ConflictsServiceServer) {
	// If the following call panics, it indicates UnimplementedConflictsServiceServer 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(&ConflictsService_ServiceDesc, srv)
}

func _ConflictsService_ListConflictFiles_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ListConflictFilesRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ConflictsServiceServer).ListConflictFiles(m, &grpc.GenericServerStream[ListConflictFilesRequest, ListConflictFilesResponse]{ServerStream: stream})
}

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

func _ConflictsService_ResolveConflicts_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ConflictsServiceServer).ResolveConflicts(&grpc.GenericServerStream[ResolveConflictsRequest, ResolveConflictsResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ConflictsService_ResolveConflictsServer = grpc.ClientStreamingServer[ResolveConflictsRequest, ResolveConflictsResponse]

// ConflictsService_ServiceDesc is the grpc.ServiceDesc for ConflictsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ConflictsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitaly.ConflictsService",
	HandlerType: (*ConflictsServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListConflictFiles",
			Handler:       _ConflictsService_ListConflictFiles_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ResolveConflicts",
			Handler:       _ConflictsService_ResolveConflicts_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "conflicts.proto",
}
