// Copyright 2016-2022 Fraunhofer AISEC
//
// 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.
//
//           $$\                           $$\ $$\   $$\
//           $$ |                          $$ |\__|  $$ |
//  $$$$$$$\ $$ | $$$$$$\  $$\   $$\  $$$$$$$ |$$\ $$$$$$\    $$$$$$\   $$$$$$\
// $$  _____|$$ |$$  __$$\ $$ |  $$ |$$  __$$ |$$ |\_$$  _|  $$  __$$\ $$  __$$\
// $$ /      $$ |$$ /  $$ |$$ |  $$ |$$ /  $$ |$$ |  $$ |    $$ /  $$ |$$ | \__|
// $$ |      $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$\ $$ |  $$ |$$ |
// \$$$$$$\  $$ |\$$$$$   |\$$$$$   |\$$$$$$  |$$ |  \$$$   |\$$$$$   |$$ |
//  \_______|\__| \______/  \______/  \_______|\__|   \____/  \______/ \__|
//
// This file is part of Clouditor Community Edition.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: api/assessment/assessment.proto

package assessment

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// 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 (
	Assessment_CalculateCompliance_FullMethodName = "/clouditor.assessment.v1.Assessment/CalculateCompliance"
	Assessment_AssessEvidence_FullMethodName      = "/clouditor.assessment.v1.Assessment/AssessEvidence"
	Assessment_AssessEvidenceStream_FullMethodName     = "/clouditor.assessment.v1.Assessment/AssessEvidenceStream"
)

// AssessmentClient is the client API for Assessment 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.
//
// Representing the link between orchestrator and discovery: Assessing evidences
// from discovery and sending results to orchestrator
type AssessmentClient interface {
	// Triggers the compliance calculation. Part of the private API. Not exposed
	// as REST.
	CalculateCompliance(ctx context.Context, in *CalculateComplianceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Assesses the evidence sent by the discovery. Part of the public API, also
	// exposed as REST.
	AssessEvidence(ctx context.Context, in *AssessEvidenceRequest, opts ...grpc.CallOption) (*AssessEvidenceResponse, error)
	// Assesses stream of evidences sent by the discovery and returns a response
	// stream. Part of the public API. Not exposed as REST.
	AssessEvidenceStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AssessEvidenceRequest, AssessEvidencesResponse], error)
}

type assessmentClient struct {
	cc grpc.ClientConnInterface
}

func NewAssessmentClient(cc grpc.ClientConnInterface) AssessmentClient {
	return &assessmentClient{cc}
}

func (c *assessmentClient) CalculateCompliance(ctx context.Context, in *CalculateComplianceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, Assessment_CalculateCompliance_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *assessmentClient) AssessEvidence(ctx context.Context, in *AssessEvidenceRequest, opts ...grpc.CallOption) (*AssessEvidenceResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(AssessEvidenceResponse)
	err := c.cc.Invoke(ctx, Assessment_AssessEvidence_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *assessmentClient) AssessEvidenceStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AssessEvidenceRequest, AssessEvidencesResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Assessment_ServiceDesc.Streams[0], Assessment_AssessEvidenceStream_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[AssessEvidenceRequest, AssessEvidencesResponse]{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 Assessment_AssessEvidenceStreamClient = grpc.BidiStreamingClient[AssessEvidenceRequest, AssessEvidencesResponse]

// AssessmentServer is the server API for Assessment service.
// All implementations must embed UnimplementedAssessmentServer
// for forward compatibility.
//
// Representing the link between orchestrator and discovery: Assessing evidences
// from discovery and sending results to orchestrator
type AssessmentServer interface {
	// Triggers the compliance calculation. Part of the private API. Not exposed
	// as REST.
	CalculateCompliance(context.Context, *CalculateComplianceRequest) (*emptypb.Empty, error)
	// Assesses the evidence sent by the discovery. Part of the public API, also
	// exposed as REST.
	AssessEvidence(context.Context, *AssessEvidenceRequest) (*AssessEvidenceResponse, error)
	// Assesses stream of evidences sent by the discovery and returns a response
	// stream. Part of the public API. Not exposed as REST.
	AssessEvidenceStream(grpc.BidiStreamingServer[AssessEvidenceRequest, AssessEvidencesResponse]) error
	mustEmbedUnimplementedAssessmentServer()
}

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

func (UnimplementedAssessmentServer) CalculateCompliance(context.Context, *CalculateComplianceRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CalculateCompliance not implemented")
}
func (UnimplementedAssessmentServer) AssessEvidence(context.Context, *AssessEvidenceRequest) (*AssessEvidenceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method AssessEvidence not implemented")
}
func (UnimplementedAssessmentServer) AssessEvidenceStream(grpc.BidiStreamingServer[AssessEvidenceRequest, AssessEvidencesResponse]) error {
	return status.Errorf(codes.Unimplemented, "method AssessEvidenceStream not implemented")
}
func (UnimplementedAssessmentServer) mustEmbedUnimplementedAssessmentServer() {}
func (UnimplementedAssessmentServer) testEmbeddedByValue()                    {}

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

func RegisterAssessmentServer(s grpc.ServiceRegistrar, srv AssessmentServer) {
	// If the following call pancis, it indicates UnimplementedAssessmentServer 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(&Assessment_ServiceDesc, srv)
}

func _Assessment_CalculateCompliance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CalculateComplianceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AssessmentServer).CalculateCompliance(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Assessment_CalculateCompliance_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AssessmentServer).CalculateCompliance(ctx, req.(*CalculateComplianceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Assessment_AssessEvidence_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AssessEvidenceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AssessmentServer).AssessEvidence(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Assessment_AssessEvidence_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AssessmentServer).AssessEvidence(ctx, req.(*AssessEvidenceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Assessment_AssessEvidenceStream_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(AssessmentServer).AssessEvidenceStream(&grpc.GenericServerStream[AssessEvidenceRequest, AssessEvidencesResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Assessment_AssessEvidenceStreamServer = grpc.BidiStreamingServer[AssessEvidenceRequest, AssessEvidencesResponse]

// Assessment_ServiceDesc is the grpc.ServiceDesc for Assessment service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Assessment_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clouditor.assessment.v1.Assessment",
	HandlerType: (*AssessmentServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CalculateCompliance",
			Handler:    _Assessment_CalculateCompliance_Handler,
		},
		{
			MethodName: "AssessEvidence",
			Handler:    _Assessment_AssessEvidence_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "AssessEvidenceStream",
			Handler:       _Assessment_AssessEvidenceStream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "api/assessment/assessment.proto",
}
