// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v5.29.3
// source: policy.proto

package proto

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 (
	Policy_Setup_FullMethodName            = "/proto.Policy/Setup"
	Policy_EvaluateResource_FullMethodName = "/proto.Policy/EvaluateResource"
	Policy_EvaluateProvider_FullMethodName = "/proto.Policy/EvaluateProvider"
	Policy_EvaluateModule_FullMethodName   = "/proto.Policy/EvaluateModule"
)

// PolicyClient is the client API for Policy 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.
//
// Policy is the main service published by the plugin.
type PolicyClient interface {
	// Setup allows the client and server to exchange known capabilities so they
	// trigger alternate behaviour to maintain forwards and backwards
	// compatibility. In addition, this call tells the plugin where to load the
	// Terraform Policy files from.
	Setup(ctx context.Context, in *PolicySetupRequest, opts ...grpc.CallOption) (*PolicySetupResponse, error)
	// Evaluate evaluates a resource against the store policies. Essentially,
	// this function simply calls the equivalent Evaluate function on the
	// internal Policy go-library.
	EvaluateResource(ctx context.Context, in *PolicyEvaluateResourceRequest, opts ...grpc.CallOption) (*PolicyEvaluateResourceResponse, error)
	// EvaluateProvider evaluates a provider configuration against the store policies.
	// This method is specifically designed for provider-level policy evaluation.
	EvaluateProvider(ctx context.Context, in *PolicyEvaluateProviderRequest, opts ...grpc.CallOption) (*PolicyEvaluateProviderResponse, error)
	// EvaluateModule evaluates a module configuration against the store modules.
	// This method is specifically designed for module-level policy evaluation.
	EvaluateModule(ctx context.Context, in *PolicyEvaluateModuleRequest, opts ...grpc.CallOption) (*PolicyEvaluateModuleResponse, error)
}

type policyClient struct {
	cc grpc.ClientConnInterface
}

func NewPolicyClient(cc grpc.ClientConnInterface) PolicyClient {
	return &policyClient{cc}
}

func (c *policyClient) Setup(ctx context.Context, in *PolicySetupRequest, opts ...grpc.CallOption) (*PolicySetupResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(PolicySetupResponse)
	err := c.cc.Invoke(ctx, Policy_Setup_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *policyClient) EvaluateResource(ctx context.Context, in *PolicyEvaluateResourceRequest, opts ...grpc.CallOption) (*PolicyEvaluateResourceResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(PolicyEvaluateResourceResponse)
	err := c.cc.Invoke(ctx, Policy_EvaluateResource_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *policyClient) EvaluateProvider(ctx context.Context, in *PolicyEvaluateProviderRequest, opts ...grpc.CallOption) (*PolicyEvaluateProviderResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(PolicyEvaluateProviderResponse)
	err := c.cc.Invoke(ctx, Policy_EvaluateProvider_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *policyClient) EvaluateModule(ctx context.Context, in *PolicyEvaluateModuleRequest, opts ...grpc.CallOption) (*PolicyEvaluateModuleResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(PolicyEvaluateModuleResponse)
	err := c.cc.Invoke(ctx, Policy_EvaluateModule_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// PolicyServer is the server API for Policy service.
// All implementations must embed UnimplementedPolicyServer
// for forward compatibility.
//
// Policy is the main service published by the plugin.
type PolicyServer interface {
	// Setup allows the client and server to exchange known capabilities so they
	// trigger alternate behaviour to maintain forwards and backwards
	// compatibility. In addition, this call tells the plugin where to load the
	// Terraform Policy files from.
	Setup(context.Context, *PolicySetupRequest) (*PolicySetupResponse, error)
	// Evaluate evaluates a resource against the store policies. Essentially,
	// this function simply calls the equivalent Evaluate function on the
	// internal Policy go-library.
	EvaluateResource(context.Context, *PolicyEvaluateResourceRequest) (*PolicyEvaluateResourceResponse, error)
	// EvaluateProvider evaluates a provider configuration against the store policies.
	// This method is specifically designed for provider-level policy evaluation.
	EvaluateProvider(context.Context, *PolicyEvaluateProviderRequest) (*PolicyEvaluateProviderResponse, error)
	// EvaluateModule evaluates a module configuration against the store modules.
	// This method is specifically designed for module-level policy evaluation.
	EvaluateModule(context.Context, *PolicyEvaluateModuleRequest) (*PolicyEvaluateModuleResponse, error)
	mustEmbedUnimplementedPolicyServer()
}

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

func (UnimplementedPolicyServer) Setup(context.Context, *PolicySetupRequest) (*PolicySetupResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Setup not implemented")
}
func (UnimplementedPolicyServer) EvaluateResource(context.Context, *PolicyEvaluateResourceRequest) (*PolicyEvaluateResourceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method EvaluateResource not implemented")
}
func (UnimplementedPolicyServer) EvaluateProvider(context.Context, *PolicyEvaluateProviderRequest) (*PolicyEvaluateProviderResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method EvaluateProvider not implemented")
}
func (UnimplementedPolicyServer) EvaluateModule(context.Context, *PolicyEvaluateModuleRequest) (*PolicyEvaluateModuleResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method EvaluateModule not implemented")
}
func (UnimplementedPolicyServer) mustEmbedUnimplementedPolicyServer() {}
func (UnimplementedPolicyServer) testEmbeddedByValue()                {}

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

func RegisterPolicyServer(s grpc.ServiceRegistrar, srv PolicyServer) {
	// If the following call pancis, it indicates UnimplementedPolicyServer 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(&Policy_ServiceDesc, srv)
}

func _Policy_Setup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PolicySetupRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PolicyServer).Setup(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Policy_Setup_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PolicyServer).Setup(ctx, req.(*PolicySetupRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Policy_EvaluateResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PolicyEvaluateResourceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PolicyServer).EvaluateResource(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Policy_EvaluateResource_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PolicyServer).EvaluateResource(ctx, req.(*PolicyEvaluateResourceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Policy_EvaluateProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PolicyEvaluateProviderRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PolicyServer).EvaluateProvider(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Policy_EvaluateProvider_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PolicyServer).EvaluateProvider(ctx, req.(*PolicyEvaluateProviderRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Policy_EvaluateModule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PolicyEvaluateModuleRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PolicyServer).EvaluateModule(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Policy_EvaluateModule_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PolicyServer).EvaluateModule(ctx, req.(*PolicyEvaluateModuleRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Policy_ServiceDesc is the grpc.ServiceDesc for Policy service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Policy_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Policy",
	HandlerType: (*PolicyServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Setup",
			Handler:    _Policy_Setup_Handler,
		},
		{
			MethodName: "EvaluateResource",
			Handler:    _Policy_EvaluateResource_Handler,
		},
		{
			MethodName: "EvaluateProvider",
			Handler:    _Policy_EvaluateProvider_Handler,
		},
		{
			MethodName: "EvaluateModule",
			Handler:    _Policy_EvaluateModule_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "policy.proto",
}
