// 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/evidence/evidence_store.proto

package evidence

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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	EvidenceStore_StoreEvidence_FullMethodName              = "/clouditor.evidence.v1.EvidenceStore/StoreEvidence"
	EvidenceStore_StoreEvidences_FullMethodName             = "/clouditor.evidence.v1.EvidenceStore/StoreEvidences"
	EvidenceStore_ListEvidences_FullMethodName              = "/clouditor.evidence.v1.EvidenceStore/ListEvidences"
	EvidenceStore_GetEvidence_FullMethodName                = "/clouditor.evidence.v1.EvidenceStore/GetEvidence"
	EvidenceStore_ListSupportedResourceTypes_FullMethodName = "/clouditor.evidence.v1.EvidenceStore/ListSupportedResourceTypes"
	EvidenceStore_ListResources_FullMethodName              = "/clouditor.evidence.v1.EvidenceStore/ListResources"
)

// EvidenceStoreClient is the client API for EvidenceStore 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.
//
// Manages the storage of evidences
type EvidenceStoreClient interface {
	// Stores an evidence to the evidence storage. Part of the public API, also
	// exposed as REST.
	StoreEvidence(ctx context.Context, in *StoreEvidenceRequest, opts ...grpc.CallOption) (*StoreEvidenceResponse, error)
	// Stores a stream of evidences to the evidence storage and returns a response
	// stream. Part of the public API, not exposed as REST.
	StoreEvidences(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StoreEvidenceRequest, StoreEvidencesResponse], error)
	// Returns all stored evidences. Part of the public API, also exposed as REST.
	ListEvidences(ctx context.Context, in *ListEvidencesRequest, opts ...grpc.CallOption) (*ListEvidencesResponse, error)
	// Returns a particular stored evidence. Part of the public API, also exposed
	// as REST.
	GetEvidence(ctx context.Context, in *GetEvidenceRequest, opts ...grpc.CallOption) (*Evidence, error)
	// Returns the resource types that are supported by the EvidenceStore.
	ListSupportedResourceTypes(ctx context.Context, in *ListSupportedResourceTypesRequest, opts ...grpc.CallOption) (*ListSupportedResourceTypesResponse, error)
	// Lists all resources collected in the last run, exposed as REST.
	ListResources(ctx context.Context, in *ListResourcesRequest, opts ...grpc.CallOption) (*ListResourcesResponse, error)
}

type evidenceStoreClient struct {
	cc grpc.ClientConnInterface
}

func NewEvidenceStoreClient(cc grpc.ClientConnInterface) EvidenceStoreClient {
	return &evidenceStoreClient{cc}
}

func (c *evidenceStoreClient) StoreEvidence(ctx context.Context, in *StoreEvidenceRequest, opts ...grpc.CallOption) (*StoreEvidenceResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(StoreEvidenceResponse)
	err := c.cc.Invoke(ctx, EvidenceStore_StoreEvidence_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *evidenceStoreClient) StoreEvidences(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StoreEvidenceRequest, StoreEvidencesResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &EvidenceStore_ServiceDesc.Streams[0], EvidenceStore_StoreEvidences_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StoreEvidenceRequest, StoreEvidencesResponse]{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 EvidenceStore_StoreEvidencesClient = grpc.BidiStreamingClient[StoreEvidenceRequest, StoreEvidencesResponse]

func (c *evidenceStoreClient) ListEvidences(ctx context.Context, in *ListEvidencesRequest, opts ...grpc.CallOption) (*ListEvidencesResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListEvidencesResponse)
	err := c.cc.Invoke(ctx, EvidenceStore_ListEvidences_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *evidenceStoreClient) GetEvidence(ctx context.Context, in *GetEvidenceRequest, opts ...grpc.CallOption) (*Evidence, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(Evidence)
	err := c.cc.Invoke(ctx, EvidenceStore_GetEvidence_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *evidenceStoreClient) ListSupportedResourceTypes(ctx context.Context, in *ListSupportedResourceTypesRequest, opts ...grpc.CallOption) (*ListSupportedResourceTypesResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListSupportedResourceTypesResponse)
	err := c.cc.Invoke(ctx, EvidenceStore_ListSupportedResourceTypes_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *evidenceStoreClient) ListResources(ctx context.Context, in *ListResourcesRequest, opts ...grpc.CallOption) (*ListResourcesResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListResourcesResponse)
	err := c.cc.Invoke(ctx, EvidenceStore_ListResources_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// EvidenceStoreServer is the server API for EvidenceStore service.
// All implementations must embed UnimplementedEvidenceStoreServer
// for forward compatibility.
//
// Manages the storage of evidences
type EvidenceStoreServer interface {
	// Stores an evidence to the evidence storage. Part of the public API, also
	// exposed as REST.
	StoreEvidence(context.Context, *StoreEvidenceRequest) (*StoreEvidenceResponse, error)
	// Stores a stream of evidences to the evidence storage and returns a response
	// stream. Part of the public API, not exposed as REST.
	StoreEvidences(grpc.BidiStreamingServer[StoreEvidenceRequest, StoreEvidencesResponse]) error
	// Returns all stored evidences. Part of the public API, also exposed as REST.
	ListEvidences(context.Context, *ListEvidencesRequest) (*ListEvidencesResponse, error)
	// Returns a particular stored evidence. Part of the public API, also exposed
	// as REST.
	GetEvidence(context.Context, *GetEvidenceRequest) (*Evidence, error)
	// Returns the resource types that are supported by the EvidenceStore.
	ListSupportedResourceTypes(context.Context, *ListSupportedResourceTypesRequest) (*ListSupportedResourceTypesResponse, error)
	// Lists all resources collected in the last run, exposed as REST.
	ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error)
	mustEmbedUnimplementedEvidenceStoreServer()
}

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

func (UnimplementedEvidenceStoreServer) StoreEvidence(context.Context, *StoreEvidenceRequest) (*StoreEvidenceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method StoreEvidence not implemented")
}
func (UnimplementedEvidenceStoreServer) StoreEvidences(grpc.BidiStreamingServer[StoreEvidenceRequest, StoreEvidencesResponse]) error {
	return status.Errorf(codes.Unimplemented, "method StoreEvidences not implemented")
}
func (UnimplementedEvidenceStoreServer) ListEvidences(context.Context, *ListEvidencesRequest) (*ListEvidencesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListEvidences not implemented")
}
func (UnimplementedEvidenceStoreServer) GetEvidence(context.Context, *GetEvidenceRequest) (*Evidence, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetEvidence not implemented")
}
func (UnimplementedEvidenceStoreServer) ListSupportedResourceTypes(context.Context, *ListSupportedResourceTypesRequest) (*ListSupportedResourceTypesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListSupportedResourceTypes not implemented")
}
func (UnimplementedEvidenceStoreServer) ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListResources not implemented")
}
func (UnimplementedEvidenceStoreServer) mustEmbedUnimplementedEvidenceStoreServer() {}
func (UnimplementedEvidenceStoreServer) testEmbeddedByValue()                       {}

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

func RegisterEvidenceStoreServer(s grpc.ServiceRegistrar, srv EvidenceStoreServer) {
	// If the following call pancis, it indicates UnimplementedEvidenceStoreServer 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(&EvidenceStore_ServiceDesc, srv)
}

func _EvidenceStore_StoreEvidence_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(StoreEvidenceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EvidenceStoreServer).StoreEvidence(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: EvidenceStore_StoreEvidence_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EvidenceStoreServer).StoreEvidence(ctx, req.(*StoreEvidenceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _EvidenceStore_StoreEvidences_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(EvidenceStoreServer).StoreEvidences(&grpc.GenericServerStream[StoreEvidenceRequest, StoreEvidencesResponse]{ServerStream: stream})
}

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

func _EvidenceStore_ListEvidences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListEvidencesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EvidenceStoreServer).ListEvidences(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: EvidenceStore_ListEvidences_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EvidenceStoreServer).ListEvidences(ctx, req.(*ListEvidencesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _EvidenceStore_GetEvidence_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetEvidenceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EvidenceStoreServer).GetEvidence(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: EvidenceStore_GetEvidence_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EvidenceStoreServer).GetEvidence(ctx, req.(*GetEvidenceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _EvidenceStore_ListSupportedResourceTypes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListSupportedResourceTypesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EvidenceStoreServer).ListSupportedResourceTypes(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: EvidenceStore_ListSupportedResourceTypes_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EvidenceStoreServer).ListSupportedResourceTypes(ctx, req.(*ListSupportedResourceTypesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _EvidenceStore_ListResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListResourcesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EvidenceStoreServer).ListResources(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: EvidenceStore_ListResources_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EvidenceStoreServer).ListResources(ctx, req.(*ListResourcesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// EvidenceStore_ServiceDesc is the grpc.ServiceDesc for EvidenceStore service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var EvidenceStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clouditor.evidence.v1.EvidenceStore",
	HandlerType: (*EvidenceStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "StoreEvidence",
			Handler:    _EvidenceStore_StoreEvidence_Handler,
		},
		{
			MethodName: "ListEvidences",
			Handler:    _EvidenceStore_ListEvidences_Handler,
		},
		{
			MethodName: "GetEvidence",
			Handler:    _EvidenceStore_GetEvidence_Handler,
		},
		{
			MethodName: "ListSupportedResourceTypes",
			Handler:    _EvidenceStore_ListSupportedResourceTypes_Handler,
		},
		{
			MethodName: "ListResources",
			Handler:    _EvidenceStore_ListResources_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StoreEvidences",
			Handler:       _EvidenceStore_StoreEvidences_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "api/evidence/evidence_store.proto",
}
