// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             (unknown)
// source: runtime/v1/mutations.proto

package runtimev1

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 (
	RecordMutationsService_MutateRecords_FullMethodName     = "/nexuscrm.runtime.v1.RecordMutationsService/MutateRecords"
	RecordMutationsService_GetMutationStatus_FullMethodName = "/nexuscrm.runtime.v1.RecordMutationsService/GetMutationStatus"
)

// RecordMutationsServiceClient is the client API for RecordMutationsService 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.
//
// RecordMutationsService owns one coarse root-record command. Identity,
// authority, tenant, and AppInstallation are authenticated transport context;
// they are never caller-selected business fields.
type RecordMutationsServiceClient interface {
	// The inner MutationCommand is protobuf-encoded and split into bounded
	// frames. This remains exactly one Runtime RPC per L1 HTTP request while
	// retaining the independent 120 KiB mutation chunk ceiling beneath the
	// shared 4 MiB private transport envelope.
	MutateRecords(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[MutateRecordsRequest, MutateRecordsResponse], error)
	GetMutationStatus(ctx context.Context, in *GetMutationStatusRequest, opts ...grpc.CallOption) (*GetMutationStatusResponse, error)
}

type recordMutationsServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewRecordMutationsServiceClient(cc grpc.ClientConnInterface) RecordMutationsServiceClient {
	return &recordMutationsServiceClient{cc}
}

func (c *recordMutationsServiceClient) MutateRecords(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[MutateRecordsRequest, MutateRecordsResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &RecordMutationsService_ServiceDesc.Streams[0], RecordMutationsService_MutateRecords_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[MutateRecordsRequest, MutateRecordsResponse]{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 RecordMutationsService_MutateRecordsClient = grpc.ClientStreamingClient[MutateRecordsRequest, MutateRecordsResponse]

func (c *recordMutationsServiceClient) GetMutationStatus(ctx context.Context, in *GetMutationStatusRequest, opts ...grpc.CallOption) (*GetMutationStatusResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetMutationStatusResponse)
	err := c.cc.Invoke(ctx, RecordMutationsService_GetMutationStatus_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// RecordMutationsServiceServer is the server API for RecordMutationsService service.
// All implementations must embed UnimplementedRecordMutationsServiceServer
// for forward compatibility.
//
// RecordMutationsService owns one coarse root-record command. Identity,
// authority, tenant, and AppInstallation are authenticated transport context;
// they are never caller-selected business fields.
type RecordMutationsServiceServer interface {
	// The inner MutationCommand is protobuf-encoded and split into bounded
	// frames. This remains exactly one Runtime RPC per L1 HTTP request while
	// retaining the independent 120 KiB mutation chunk ceiling beneath the
	// shared 4 MiB private transport envelope.
	MutateRecords(grpc.ClientStreamingServer[MutateRecordsRequest, MutateRecordsResponse]) error
	GetMutationStatus(context.Context, *GetMutationStatusRequest) (*GetMutationStatusResponse, error)
	mustEmbedUnimplementedRecordMutationsServiceServer()
}

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

func (UnimplementedRecordMutationsServiceServer) MutateRecords(grpc.ClientStreamingServer[MutateRecordsRequest, MutateRecordsResponse]) error {
	return status.Error(codes.Unimplemented, "method MutateRecords not implemented")
}
func (UnimplementedRecordMutationsServiceServer) GetMutationStatus(context.Context, *GetMutationStatusRequest) (*GetMutationStatusResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method GetMutationStatus not implemented")
}
func (UnimplementedRecordMutationsServiceServer) mustEmbedUnimplementedRecordMutationsServiceServer() {
}
func (UnimplementedRecordMutationsServiceServer) testEmbeddedByValue() {}

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

func RegisterRecordMutationsServiceServer(s grpc.ServiceRegistrar, srv RecordMutationsServiceServer) {
	// If the following call panics, it indicates UnimplementedRecordMutationsServiceServer 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(&RecordMutationsService_ServiceDesc, srv)
}

func _RecordMutationsService_MutateRecords_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(RecordMutationsServiceServer).MutateRecords(&grpc.GenericServerStream[MutateRecordsRequest, MutateRecordsResponse]{ServerStream: stream})
}

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

func _RecordMutationsService_GetMutationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetMutationStatusRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RecordMutationsServiceServer).GetMutationStatus(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: RecordMutationsService_GetMutationStatus_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RecordMutationsServiceServer).GetMutationStatus(ctx, req.(*GetMutationStatusRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// RecordMutationsService_ServiceDesc is the grpc.ServiceDesc for RecordMutationsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RecordMutationsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "nexuscrm.runtime.v1.RecordMutationsService",
	HandlerType: (*RecordMutationsServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetMutationStatus",
			Handler:    _RecordMutationsService_GetMutationStatus_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "MutateRecords",
			Handler:       _RecordMutationsService_MutateRecords_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "runtime/v1/mutations.proto",
}
