//
// Copyright 2024-2025 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             (unknown)
// source: controlplane/v1/organization.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

const (
	OrganizationService_Create_FullMethodName           = "/controlplane.v1.OrganizationService/Create"
	OrganizationService_Update_FullMethodName           = "/controlplane.v1.OrganizationService/Update"
	OrganizationService_Delete_FullMethodName           = "/controlplane.v1.OrganizationService/Delete"
	OrganizationService_ListMemberships_FullMethodName  = "/controlplane.v1.OrganizationService/ListMemberships"
	OrganizationService_DeleteMembership_FullMethodName = "/controlplane.v1.OrganizationService/DeleteMembership"
	OrganizationService_UpdateMembership_FullMethodName = "/controlplane.v1.OrganizationService/UpdateMembership"
)

// OrganizationServiceClient is the client API for OrganizationService 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 OrganizationServiceClient interface {
	Create(ctx context.Context, in *OrganizationServiceCreateRequest, opts ...grpc.CallOption) (*OrganizationServiceCreateResponse, error)
	Update(ctx context.Context, in *OrganizationServiceUpdateRequest, opts ...grpc.CallOption) (*OrganizationServiceUpdateResponse, error)
	// Delete an organization
	// Only organization owners can delete the organization
	Delete(ctx context.Context, in *OrganizationServiceDeleteRequest, opts ...grpc.CallOption) (*OrganizationServiceDeleteResponse, error)
	// List members in the organization
	ListMemberships(ctx context.Context, in *OrganizationServiceListMembershipsRequest, opts ...grpc.CallOption) (*OrganizationServiceListMembershipsResponse, error)
	// Delete member from the organization
	// Currently the currentUser can not delete himself from this endpoint
	// for that she needs to use the UserService endpoint instead
	DeleteMembership(ctx context.Context, in *OrganizationServiceDeleteMembershipRequest, opts ...grpc.CallOption) (*OrganizationServiceDeleteMembershipResponse, error)
	UpdateMembership(ctx context.Context, in *OrganizationServiceUpdateMembershipRequest, opts ...grpc.CallOption) (*OrganizationServiceUpdateMembershipResponse, error)
}

type organizationServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewOrganizationServiceClient(cc grpc.ClientConnInterface) OrganizationServiceClient {
	return &organizationServiceClient{cc}
}

func (c *organizationServiceClient) Create(ctx context.Context, in *OrganizationServiceCreateRequest, opts ...grpc.CallOption) (*OrganizationServiceCreateResponse, error) {
	out := new(OrganizationServiceCreateResponse)
	err := c.cc.Invoke(ctx, OrganizationService_Create_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *organizationServiceClient) Update(ctx context.Context, in *OrganizationServiceUpdateRequest, opts ...grpc.CallOption) (*OrganizationServiceUpdateResponse, error) {
	out := new(OrganizationServiceUpdateResponse)
	err := c.cc.Invoke(ctx, OrganizationService_Update_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *organizationServiceClient) Delete(ctx context.Context, in *OrganizationServiceDeleteRequest, opts ...grpc.CallOption) (*OrganizationServiceDeleteResponse, error) {
	out := new(OrganizationServiceDeleteResponse)
	err := c.cc.Invoke(ctx, OrganizationService_Delete_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *organizationServiceClient) ListMemberships(ctx context.Context, in *OrganizationServiceListMembershipsRequest, opts ...grpc.CallOption) (*OrganizationServiceListMembershipsResponse, error) {
	out := new(OrganizationServiceListMembershipsResponse)
	err := c.cc.Invoke(ctx, OrganizationService_ListMemberships_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *organizationServiceClient) DeleteMembership(ctx context.Context, in *OrganizationServiceDeleteMembershipRequest, opts ...grpc.CallOption) (*OrganizationServiceDeleteMembershipResponse, error) {
	out := new(OrganizationServiceDeleteMembershipResponse)
	err := c.cc.Invoke(ctx, OrganizationService_DeleteMembership_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *organizationServiceClient) UpdateMembership(ctx context.Context, in *OrganizationServiceUpdateMembershipRequest, opts ...grpc.CallOption) (*OrganizationServiceUpdateMembershipResponse, error) {
	out := new(OrganizationServiceUpdateMembershipResponse)
	err := c.cc.Invoke(ctx, OrganizationService_UpdateMembership_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// OrganizationServiceServer is the server API for OrganizationService service.
// All implementations must embed UnimplementedOrganizationServiceServer
// for forward compatibility
type OrganizationServiceServer interface {
	Create(context.Context, *OrganizationServiceCreateRequest) (*OrganizationServiceCreateResponse, error)
	Update(context.Context, *OrganizationServiceUpdateRequest) (*OrganizationServiceUpdateResponse, error)
	// Delete an organization
	// Only organization owners can delete the organization
	Delete(context.Context, *OrganizationServiceDeleteRequest) (*OrganizationServiceDeleteResponse, error)
	// List members in the organization
	ListMemberships(context.Context, *OrganizationServiceListMembershipsRequest) (*OrganizationServiceListMembershipsResponse, error)
	// Delete member from the organization
	// Currently the currentUser can not delete himself from this endpoint
	// for that she needs to use the UserService endpoint instead
	DeleteMembership(context.Context, *OrganizationServiceDeleteMembershipRequest) (*OrganizationServiceDeleteMembershipResponse, error)
	UpdateMembership(context.Context, *OrganizationServiceUpdateMembershipRequest) (*OrganizationServiceUpdateMembershipResponse, error)
	mustEmbedUnimplementedOrganizationServiceServer()
}

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

func (UnimplementedOrganizationServiceServer) Create(context.Context, *OrganizationServiceCreateRequest) (*OrganizationServiceCreateResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedOrganizationServiceServer) Update(context.Context, *OrganizationServiceUpdateRequest) (*OrganizationServiceUpdateResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (UnimplementedOrganizationServiceServer) Delete(context.Context, *OrganizationServiceDeleteRequest) (*OrganizationServiceDeleteResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedOrganizationServiceServer) ListMemberships(context.Context, *OrganizationServiceListMembershipsRequest) (*OrganizationServiceListMembershipsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListMemberships not implemented")
}
func (UnimplementedOrganizationServiceServer) DeleteMembership(context.Context, *OrganizationServiceDeleteMembershipRequest) (*OrganizationServiceDeleteMembershipResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DeleteMembership not implemented")
}
func (UnimplementedOrganizationServiceServer) UpdateMembership(context.Context, *OrganizationServiceUpdateMembershipRequest) (*OrganizationServiceUpdateMembershipResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method UpdateMembership not implemented")
}
func (UnimplementedOrganizationServiceServer) mustEmbedUnimplementedOrganizationServiceServer() {}

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

func RegisterOrganizationServiceServer(s grpc.ServiceRegistrar, srv OrganizationServiceServer) {
	s.RegisterService(&OrganizationService_ServiceDesc, srv)
}

func _OrganizationService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(OrganizationServiceCreateRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(OrganizationServiceServer).Create(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: OrganizationService_Create_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(OrganizationServiceServer).Create(ctx, req.(*OrganizationServiceCreateRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _OrganizationService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(OrganizationServiceUpdateRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(OrganizationServiceServer).Update(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: OrganizationService_Update_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(OrganizationServiceServer).Update(ctx, req.(*OrganizationServiceUpdateRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _OrganizationService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(OrganizationServiceDeleteRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(OrganizationServiceServer).Delete(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: OrganizationService_Delete_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(OrganizationServiceServer).Delete(ctx, req.(*OrganizationServiceDeleteRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _OrganizationService_ListMemberships_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(OrganizationServiceListMembershipsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(OrganizationServiceServer).ListMemberships(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: OrganizationService_ListMemberships_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(OrganizationServiceServer).ListMemberships(ctx, req.(*OrganizationServiceListMembershipsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _OrganizationService_DeleteMembership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(OrganizationServiceDeleteMembershipRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(OrganizationServiceServer).DeleteMembership(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: OrganizationService_DeleteMembership_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(OrganizationServiceServer).DeleteMembership(ctx, req.(*OrganizationServiceDeleteMembershipRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _OrganizationService_UpdateMembership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(OrganizationServiceUpdateMembershipRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(OrganizationServiceServer).UpdateMembership(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: OrganizationService_UpdateMembership_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(OrganizationServiceServer).UpdateMembership(ctx, req.(*OrganizationServiceUpdateMembershipRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// OrganizationService_ServiceDesc is the grpc.ServiceDesc for OrganizationService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var OrganizationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "controlplane.v1.OrganizationService",
	HandlerType: (*OrganizationServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _OrganizationService_Create_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _OrganizationService_Update_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _OrganizationService_Delete_Handler,
		},
		{
			MethodName: "ListMemberships",
			Handler:    _OrganizationService_ListMemberships_Handler,
		},
		{
			MethodName: "DeleteMembership",
			Handler:    _OrganizationService_DeleteMembership_Handler,
		},
		{
			MethodName: "UpdateMembership",
			Handler:    _OrganizationService_UpdateMembership_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "controlplane/v1/organization.proto",
}
