// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: qsfera/services/policies/v0/policies.proto

package v0

import (
	fmt "fmt"
	_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
	_ "github.com/qsfera/server/protogen/gen/qsfera/messages/policies/v0"
	_ "google.golang.org/genproto/googleapis/api/annotations"
	proto "google.golang.org/protobuf/proto"
	math "math"
)

import (
	context "context"
	api "go-micro.dev/v4/api"
	client "go-micro.dev/v4/client"
	server "go-micro.dev/v4/server"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option

// Api Endpoints for PoliciesProvider service

func NewPoliciesProviderEndpoints() []*api.Endpoint {
	return []*api.Endpoint{
		{
			Name:    "PoliciesProvider.Evaluate",
			Path:    []string{"/api/v0/policies/evaluate"},
			Method:  []string{"POST"},
			Handler: "rpc",
		},
	}
}

// Client API for PoliciesProvider service

type PoliciesProviderService interface {
	Evaluate(ctx context.Context, in *EvaluateRequest, opts ...client.CallOption) (*EvaluateResponse, error)
}

type policiesProviderService struct {
	c    client.Client
	name string
}

func NewPoliciesProviderService(name string, c client.Client) PoliciesProviderService {
	return &policiesProviderService{
		c:    c,
		name: name,
	}
}

func (c *policiesProviderService) Evaluate(ctx context.Context, in *EvaluateRequest, opts ...client.CallOption) (*EvaluateResponse, error) {
	req := c.c.NewRequest(c.name, "PoliciesProvider.Evaluate", in)
	out := new(EvaluateResponse)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for PoliciesProvider service

type PoliciesProviderHandler interface {
	Evaluate(context.Context, *EvaluateRequest, *EvaluateResponse) error
}

func RegisterPoliciesProviderHandler(s server.Server, hdlr PoliciesProviderHandler, opts ...server.HandlerOption) error {
	type policiesProvider interface {
		Evaluate(ctx context.Context, in *EvaluateRequest, out *EvaluateResponse) error
	}
	type PoliciesProvider struct {
		policiesProvider
	}
	h := &policiesProviderHandler{hdlr}
	opts = append(opts, api.WithEndpoint(&api.Endpoint{
		Name:    "PoliciesProvider.Evaluate",
		Path:    []string{"/api/v0/policies/evaluate"},
		Method:  []string{"POST"},
		Handler: "rpc",
	}))
	return s.Handle(s.NewHandler(&PoliciesProvider{h}, opts...))
}

type policiesProviderHandler struct {
	PoliciesProviderHandler
}

func (h *policiesProviderHandler) Evaluate(ctx context.Context, in *EvaluateRequest, out *EvaluateResponse) error {
	return h.PoliciesProviderHandler.Evaluate(ctx, in, out)
}
