//
//Copyright © 2024 Acronis International GmbH.
//
//Released under MIT license.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v5.29.2
// source: idp_token.proto

package pb

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 (
	IDPTokenService_CreateToken_FullMethodName     = "/idp_token.IDPTokenService/CreateToken"
	IDPTokenService_IntrospectToken_FullMethodName = "/idp_token.IDPTokenService/IntrospectToken"
)

// IDPTokenServiceClient is the client API for IDPTokenService 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 IDPTokenServiceClient interface {
	// CreateToken creates a new token based on the provided assertion.
	// Currently only "urn:ietf:params:oauth:grant-type:jwt-bearer" grant type is supported.
	CreateToken(ctx context.Context, in *CreateTokenRequest, opts ...grpc.CallOption) (*CreateTokenResponse, error)
	// IntrospectToken returns information about the token including its scopes.
	// The token is considered active if
	//  1. it's not expired;
	//  2. it's not revoked;
	//  3. it has a valid signature.
	IntrospectToken(ctx context.Context, in *IntrospectTokenRequest, opts ...grpc.CallOption) (*IntrospectTokenResponse, error)
}

type iDPTokenServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewIDPTokenServiceClient(cc grpc.ClientConnInterface) IDPTokenServiceClient {
	return &iDPTokenServiceClient{cc}
}

func (c *iDPTokenServiceClient) CreateToken(ctx context.Context, in *CreateTokenRequest, opts ...grpc.CallOption) (*CreateTokenResponse, error) {
	out := new(CreateTokenResponse)
	err := c.cc.Invoke(ctx, IDPTokenService_CreateToken_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *iDPTokenServiceClient) IntrospectToken(ctx context.Context, in *IntrospectTokenRequest, opts ...grpc.CallOption) (*IntrospectTokenResponse, error) {
	out := new(IntrospectTokenResponse)
	err := c.cc.Invoke(ctx, IDPTokenService_IntrospectToken_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// IDPTokenServiceServer is the server API for IDPTokenService service.
// All implementations must embed UnimplementedIDPTokenServiceServer
// for forward compatibility
type IDPTokenServiceServer interface {
	// CreateToken creates a new token based on the provided assertion.
	// Currently only "urn:ietf:params:oauth:grant-type:jwt-bearer" grant type is supported.
	CreateToken(context.Context, *CreateTokenRequest) (*CreateTokenResponse, error)
	// IntrospectToken returns information about the token including its scopes.
	// The token is considered active if
	//  1. it's not expired;
	//  2. it's not revoked;
	//  3. it has a valid signature.
	IntrospectToken(context.Context, *IntrospectTokenRequest) (*IntrospectTokenResponse, error)
	mustEmbedUnimplementedIDPTokenServiceServer()
}

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

func (UnimplementedIDPTokenServiceServer) CreateToken(context.Context, *CreateTokenRequest) (*CreateTokenResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateToken not implemented")
}
func (UnimplementedIDPTokenServiceServer) IntrospectToken(context.Context, *IntrospectTokenRequest) (*IntrospectTokenResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method IntrospectToken not implemented")
}
func (UnimplementedIDPTokenServiceServer) mustEmbedUnimplementedIDPTokenServiceServer() {}

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

func RegisterIDPTokenServiceServer(s grpc.ServiceRegistrar, srv IDPTokenServiceServer) {
	s.RegisterService(&IDPTokenService_ServiceDesc, srv)
}

func _IDPTokenService_CreateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CreateTokenRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(IDPTokenServiceServer).CreateToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: IDPTokenService_CreateToken_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(IDPTokenServiceServer).CreateToken(ctx, req.(*CreateTokenRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _IDPTokenService_IntrospectToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(IntrospectTokenRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(IDPTokenServiceServer).IntrospectToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: IDPTokenService_IntrospectToken_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(IDPTokenServiceServer).IntrospectToken(ctx, req.(*IntrospectTokenRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// IDPTokenService_ServiceDesc is the grpc.ServiceDesc for IDPTokenService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var IDPTokenService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "idp_token.IDPTokenService",
	HandlerType: (*IDPTokenServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateToken",
			Handler:    _IDPTokenService_CreateToken_Handler,
		},
		{
			MethodName: "IntrospectToken",
			Handler:    _IDPTokenService_IntrospectToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "idp_token.proto",
}
