// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v5.29.3
// source: v1/dispatcher.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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// V1DispatcherClient is the client API for V1Dispatcher 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 V1DispatcherClient interface {
	DurableTask(ctx context.Context, opts ...grpc.CallOption) (V1Dispatcher_DurableTaskClient, error)
	// NOTE: deprecated after DurableEventLog is implemented
	RegisterDurableEvent(ctx context.Context, in *RegisterDurableEventRequest, opts ...grpc.CallOption) (*RegisterDurableEventResponse, error)
	ListenForDurableEvent(ctx context.Context, opts ...grpc.CallOption) (V1Dispatcher_ListenForDurableEventClient, error)
}

type v1DispatcherClient struct {
	cc grpc.ClientConnInterface
}

func NewV1DispatcherClient(cc grpc.ClientConnInterface) V1DispatcherClient {
	return &v1DispatcherClient{cc}
}

func (c *v1DispatcherClient) DurableTask(ctx context.Context, opts ...grpc.CallOption) (V1Dispatcher_DurableTaskClient, error) {
	stream, err := c.cc.NewStream(ctx, &V1Dispatcher_ServiceDesc.Streams[0], "/v1.V1Dispatcher/DurableTask", opts...)
	if err != nil {
		return nil, err
	}
	x := &v1DispatcherDurableTaskClient{stream}
	return x, nil
}

type V1Dispatcher_DurableTaskClient interface {
	Send(*DurableTaskRequest) error
	Recv() (*DurableTaskResponse, error)
	grpc.ClientStream
}

type v1DispatcherDurableTaskClient struct {
	grpc.ClientStream
}

func (x *v1DispatcherDurableTaskClient) Send(m *DurableTaskRequest) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *v1DispatcherClient) RegisterDurableEvent(ctx context.Context, in *RegisterDurableEventRequest, opts ...grpc.CallOption) (*RegisterDurableEventResponse, error) {
	out := new(RegisterDurableEventResponse)
	err := c.cc.Invoke(ctx, "/v1.V1Dispatcher/RegisterDurableEvent", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *v1DispatcherClient) ListenForDurableEvent(ctx context.Context, opts ...grpc.CallOption) (V1Dispatcher_ListenForDurableEventClient, error) {
	stream, err := c.cc.NewStream(ctx, &V1Dispatcher_ServiceDesc.Streams[1], "/v1.V1Dispatcher/ListenForDurableEvent", opts...)
	if err != nil {
		return nil, err
	}
	x := &v1DispatcherListenForDurableEventClient{stream}
	return x, nil
}

type V1Dispatcher_ListenForDurableEventClient interface {
	Send(*ListenForDurableEventRequest) error
	Recv() (*DurableEvent, error)
	grpc.ClientStream
}

type v1DispatcherListenForDurableEventClient struct {
	grpc.ClientStream
}

func (x *v1DispatcherListenForDurableEventClient) Send(m *ListenForDurableEventRequest) error {
	return x.ClientStream.SendMsg(m)
}

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

// V1DispatcherServer is the server API for V1Dispatcher service.
// All implementations must embed UnimplementedV1DispatcherServer
// for forward compatibility
type V1DispatcherServer interface {
	DurableTask(V1Dispatcher_DurableTaskServer) error
	// NOTE: deprecated after DurableEventLog is implemented
	RegisterDurableEvent(context.Context, *RegisterDurableEventRequest) (*RegisterDurableEventResponse, error)
	ListenForDurableEvent(V1Dispatcher_ListenForDurableEventServer) error
	mustEmbedUnimplementedV1DispatcherServer()
}

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

func (UnimplementedV1DispatcherServer) DurableTask(V1Dispatcher_DurableTaskServer) error {
	return status.Errorf(codes.Unimplemented, "method DurableTask not implemented")
}
func (UnimplementedV1DispatcherServer) RegisterDurableEvent(context.Context, *RegisterDurableEventRequest) (*RegisterDurableEventResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RegisterDurableEvent not implemented")
}
func (UnimplementedV1DispatcherServer) ListenForDurableEvent(V1Dispatcher_ListenForDurableEventServer) error {
	return status.Errorf(codes.Unimplemented, "method ListenForDurableEvent not implemented")
}
func (UnimplementedV1DispatcherServer) mustEmbedUnimplementedV1DispatcherServer() {}

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

func RegisterV1DispatcherServer(s grpc.ServiceRegistrar, srv V1DispatcherServer) {
	s.RegisterService(&V1Dispatcher_ServiceDesc, srv)
}

func _V1Dispatcher_DurableTask_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(V1DispatcherServer).DurableTask(&v1DispatcherDurableTaskServer{stream})
}

type V1Dispatcher_DurableTaskServer interface {
	Send(*DurableTaskResponse) error
	Recv() (*DurableTaskRequest, error)
	grpc.ServerStream
}

type v1DispatcherDurableTaskServer struct {
	grpc.ServerStream
}

func (x *v1DispatcherDurableTaskServer) Send(m *DurableTaskResponse) error {
	return x.ServerStream.SendMsg(m)
}

func (x *v1DispatcherDurableTaskServer) Recv() (*DurableTaskRequest, error) {
	m := new(DurableTaskRequest)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _V1Dispatcher_RegisterDurableEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RegisterDurableEventRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(V1DispatcherServer).RegisterDurableEvent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/v1.V1Dispatcher/RegisterDurableEvent",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(V1DispatcherServer).RegisterDurableEvent(ctx, req.(*RegisterDurableEventRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _V1Dispatcher_ListenForDurableEvent_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(V1DispatcherServer).ListenForDurableEvent(&v1DispatcherListenForDurableEventServer{stream})
}

type V1Dispatcher_ListenForDurableEventServer interface {
	Send(*DurableEvent) error
	Recv() (*ListenForDurableEventRequest, error)
	grpc.ServerStream
}

type v1DispatcherListenForDurableEventServer struct {
	grpc.ServerStream
}

func (x *v1DispatcherListenForDurableEventServer) Send(m *DurableEvent) error {
	return x.ServerStream.SendMsg(m)
}

func (x *v1DispatcherListenForDurableEventServer) Recv() (*ListenForDurableEventRequest, error) {
	m := new(ListenForDurableEventRequest)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// V1Dispatcher_ServiceDesc is the grpc.ServiceDesc for V1Dispatcher service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var V1Dispatcher_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v1.V1Dispatcher",
	HandlerType: (*V1DispatcherServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegisterDurableEvent",
			Handler:    _V1Dispatcher_RegisterDurableEvent_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "DurableTask",
			Handler:       _V1Dispatcher_DurableTask_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "ListenForDurableEvent",
			Handler:       _V1Dispatcher_ListenForDurableEvent_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "v1/dispatcher.proto",
}
