//
// 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/api_token.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 (
	APITokenService_Create_FullMethodName = "/controlplane.v1.APITokenService/Create"
	APITokenService_List_FullMethodName   = "/controlplane.v1.APITokenService/List"
	APITokenService_Revoke_FullMethodName = "/controlplane.v1.APITokenService/Revoke"
)

// APITokenServiceClient is the client API for APITokenService 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 APITokenServiceClient interface {
	Create(ctx context.Context, in *APITokenServiceCreateRequest, opts ...grpc.CallOption) (*APITokenServiceCreateResponse, error)
	List(ctx context.Context, in *APITokenServiceListRequest, opts ...grpc.CallOption) (*APITokenServiceListResponse, error)
	Revoke(ctx context.Context, in *APITokenServiceRevokeRequest, opts ...grpc.CallOption) (*APITokenServiceRevokeResponse, error)
}

type aPITokenServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewAPITokenServiceClient(cc grpc.ClientConnInterface) APITokenServiceClient {
	return &aPITokenServiceClient{cc}
}

func (c *aPITokenServiceClient) Create(ctx context.Context, in *APITokenServiceCreateRequest, opts ...grpc.CallOption) (*APITokenServiceCreateResponse, error) {
	out := new(APITokenServiceCreateResponse)
	err := c.cc.Invoke(ctx, APITokenService_Create_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *aPITokenServiceClient) List(ctx context.Context, in *APITokenServiceListRequest, opts ...grpc.CallOption) (*APITokenServiceListResponse, error) {
	out := new(APITokenServiceListResponse)
	err := c.cc.Invoke(ctx, APITokenService_List_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *aPITokenServiceClient) Revoke(ctx context.Context, in *APITokenServiceRevokeRequest, opts ...grpc.CallOption) (*APITokenServiceRevokeResponse, error) {
	out := new(APITokenServiceRevokeResponse)
	err := c.cc.Invoke(ctx, APITokenService_Revoke_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// APITokenServiceServer is the server API for APITokenService service.
// All implementations must embed UnimplementedAPITokenServiceServer
// for forward compatibility
type APITokenServiceServer interface {
	Create(context.Context, *APITokenServiceCreateRequest) (*APITokenServiceCreateResponse, error)
	List(context.Context, *APITokenServiceListRequest) (*APITokenServiceListResponse, error)
	Revoke(context.Context, *APITokenServiceRevokeRequest) (*APITokenServiceRevokeResponse, error)
	mustEmbedUnimplementedAPITokenServiceServer()
}

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

func (UnimplementedAPITokenServiceServer) Create(context.Context, *APITokenServiceCreateRequest) (*APITokenServiceCreateResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedAPITokenServiceServer) List(context.Context, *APITokenServiceListRequest) (*APITokenServiceListResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedAPITokenServiceServer) Revoke(context.Context, *APITokenServiceRevokeRequest) (*APITokenServiceRevokeResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Revoke not implemented")
}
func (UnimplementedAPITokenServiceServer) mustEmbedUnimplementedAPITokenServiceServer() {}

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

func RegisterAPITokenServiceServer(s grpc.ServiceRegistrar, srv APITokenServiceServer) {
	s.RegisterService(&APITokenService_ServiceDesc, srv)
}

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

func _APITokenService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(APITokenServiceListRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(APITokenServiceServer).List(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: APITokenService_List_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(APITokenServiceServer).List(ctx, req.(*APITokenServiceListRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _APITokenService_Revoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(APITokenServiceRevokeRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(APITokenServiceServer).Revoke(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: APITokenService_Revoke_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(APITokenServiceServer).Revoke(ctx, req.(*APITokenServiceRevokeRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// APITokenService_ServiceDesc is the grpc.ServiceDesc for APITokenService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var APITokenService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "controlplane.v1.APITokenService",
	HandlerType: (*APITokenServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _APITokenService_Create_Handler,
		},
		{
			MethodName: "List",
			Handler:    _APITokenService_List_Handler,
		},
		{
			MethodName: "Revoke",
			Handler:    _APITokenService_Revoke_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "controlplane/v1/api_token.proto",
}
