// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v3.21.12
// source: yandex/cloud/marketplace/licensemanager/saas/v1/lock_service.proto

package licensemanager

import (
	context "context"
	v1 "github.com/yandex-cloud/go-genproto/yandex/cloud/marketplace/licensemanager/v1"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	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 (
	LockService_Ensure_FullMethodName          = "/yandex.cloud.marketplace.licensemanager.saas.v1.LockService/Ensure"
	LockService_Get_FullMethodName             = "/yandex.cloud.marketplace.licensemanager.saas.v1.LockService/Get"
	LockService_GetByResourceID_FullMethodName = "/yandex.cloud.marketplace.licensemanager.saas.v1.LockService/GetByResourceID"
)

// LockServiceClient is the client API for LockService 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.
//
// A set of methods for managing subscription locks.
type LockServiceClient interface {
	// Checks if the she specified subscription is already locked to the specified resource.
	// If it is not locked, locks the subscription to the resource.
	Ensure(ctx context.Context, in *EnsureLockRequest, opts ...grpc.CallOption) (*operation.Operation, error)
	// Returns the specified subscription lock.
	Get(ctx context.Context, in *GetLockRequest, opts ...grpc.CallOption) (*v1.Lock, error)
	// Returns the subscription lock for given resource and subscription.
	GetByResourceID(ctx context.Context, in *GetLockByResourceIDRequest, opts ...grpc.CallOption) (*v1.Lock, error)
}

type lockServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewLockServiceClient(cc grpc.ClientConnInterface) LockServiceClient {
	return &lockServiceClient{cc}
}

func (c *lockServiceClient) Ensure(ctx context.Context, in *EnsureLockRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(operation.Operation)
	err := c.cc.Invoke(ctx, LockService_Ensure_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *lockServiceClient) Get(ctx context.Context, in *GetLockRequest, opts ...grpc.CallOption) (*v1.Lock, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v1.Lock)
	err := c.cc.Invoke(ctx, LockService_Get_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *lockServiceClient) GetByResourceID(ctx context.Context, in *GetLockByResourceIDRequest, opts ...grpc.CallOption) (*v1.Lock, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v1.Lock)
	err := c.cc.Invoke(ctx, LockService_GetByResourceID_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// LockServiceServer is the server API for LockService service.
// All implementations should embed UnimplementedLockServiceServer
// for forward compatibility.
//
// A set of methods for managing subscription locks.
type LockServiceServer interface {
	// Checks if the she specified subscription is already locked to the specified resource.
	// If it is not locked, locks the subscription to the resource.
	Ensure(context.Context, *EnsureLockRequest) (*operation.Operation, error)
	// Returns the specified subscription lock.
	Get(context.Context, *GetLockRequest) (*v1.Lock, error)
	// Returns the subscription lock for given resource and subscription.
	GetByResourceID(context.Context, *GetLockByResourceIDRequest) (*v1.Lock, error)
}

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

func (UnimplementedLockServiceServer) Ensure(context.Context, *EnsureLockRequest) (*operation.Operation, error) {
	return nil, status.Error(codes.Unimplemented, "method Ensure not implemented")
}
func (UnimplementedLockServiceServer) Get(context.Context, *GetLockRequest) (*v1.Lock, error) {
	return nil, status.Error(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedLockServiceServer) GetByResourceID(context.Context, *GetLockByResourceIDRequest) (*v1.Lock, error) {
	return nil, status.Error(codes.Unimplemented, "method GetByResourceID not implemented")
}
func (UnimplementedLockServiceServer) testEmbeddedByValue() {}

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

func RegisterLockServiceServer(s grpc.ServiceRegistrar, srv LockServiceServer) {
	// If the following call panics, it indicates UnimplementedLockServiceServer 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(&LockService_ServiceDesc, srv)
}

func _LockService_Ensure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EnsureLockRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(LockServiceServer).Ensure(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: LockService_Ensure_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(LockServiceServer).Ensure(ctx, req.(*EnsureLockRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _LockService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetLockRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(LockServiceServer).Get(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: LockService_Get_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(LockServiceServer).Get(ctx, req.(*GetLockRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _LockService_GetByResourceID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetLockByResourceIDRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(LockServiceServer).GetByResourceID(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: LockService_GetByResourceID_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(LockServiceServer).GetByResourceID(ctx, req.(*GetLockByResourceIDRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// LockService_ServiceDesc is the grpc.ServiceDesc for LockService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var LockService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.marketplace.licensemanager.saas.v1.LockService",
	HandlerType: (*LockServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Ensure",
			Handler:    _LockService_Ensure_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _LockService_Get_Handler,
		},
		{
			MethodName: "GetByResourceID",
			Handler:    _LockService_GetByResourceID_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/marketplace/licensemanager/saas/v1/lock_service.proto",
}
