// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: qsfera/services/search/v0/search.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/search/v0"
	_ "google.golang.org/genproto/googleapis/api/annotations"
	proto "google.golang.org/protobuf/proto"
	_ "google.golang.org/protobuf/types/known/fieldmaskpb"
	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 SearchProvider service

func NewSearchProviderEndpoints() []*api.Endpoint {
	return []*api.Endpoint{
		{
			Name:    "SearchProvider.Search",
			Path:    []string{"/api/v0/search/search"},
			Method:  []string{"POST"},
			Handler: "rpc",
		},
		{
			Name:    "SearchProvider.IndexSpace",
			Path:    []string{"/api/v0/search/index-space"},
			Method:  []string{"POST"},
			Handler: "rpc",
		},
	}
}

// Client API for SearchProvider service

type SearchProviderService interface {
	Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error)
	IndexSpace(ctx context.Context, in *IndexSpaceRequest, opts ...client.CallOption) (*IndexSpaceResponse, error)
}

type searchProviderService struct {
	c    client.Client
	name string
}

func NewSearchProviderService(name string, c client.Client) SearchProviderService {
	return &searchProviderService{
		c:    c,
		name: name,
	}
}

func (c *searchProviderService) Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error) {
	req := c.c.NewRequest(c.name, "SearchProvider.Search", in)
	out := new(SearchResponse)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *searchProviderService) IndexSpace(ctx context.Context, in *IndexSpaceRequest, opts ...client.CallOption) (*IndexSpaceResponse, error) {
	req := c.c.NewRequest(c.name, "SearchProvider.IndexSpace", in)
	out := new(IndexSpaceResponse)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for SearchProvider service

type SearchProviderHandler interface {
	Search(context.Context, *SearchRequest, *SearchResponse) error
	IndexSpace(context.Context, *IndexSpaceRequest, *IndexSpaceResponse) error
}

func RegisterSearchProviderHandler(s server.Server, hdlr SearchProviderHandler, opts ...server.HandlerOption) error {
	type searchProvider interface {
		Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error
		IndexSpace(ctx context.Context, in *IndexSpaceRequest, out *IndexSpaceResponse) error
	}
	type SearchProvider struct {
		searchProvider
	}
	h := &searchProviderHandler{hdlr}
	opts = append(opts, api.WithEndpoint(&api.Endpoint{
		Name:    "SearchProvider.Search",
		Path:    []string{"/api/v0/search/search"},
		Method:  []string{"POST"},
		Handler: "rpc",
	}))
	opts = append(opts, api.WithEndpoint(&api.Endpoint{
		Name:    "SearchProvider.IndexSpace",
		Path:    []string{"/api/v0/search/index-space"},
		Method:  []string{"POST"},
		Handler: "rpc",
	}))
	return s.Handle(s.NewHandler(&SearchProvider{h}, opts...))
}

type searchProviderHandler struct {
	SearchProviderHandler
}

func (h *searchProviderHandler) Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error {
	return h.SearchProviderHandler.Search(ctx, in, out)
}

func (h *searchProviderHandler) IndexSpace(ctx context.Context, in *IndexSpaceRequest, out *IndexSpaceResponse) error {
	return h.SearchProviderHandler.IndexSpace(ctx, in, out)
}

// Api Endpoints for IndexProvider service

func NewIndexProviderEndpoints() []*api.Endpoint {
	return []*api.Endpoint{
		{
			Name:    "IndexProvider.Search",
			Path:    []string{"/api/v0/search/index/search"},
			Method:  []string{"POST"},
			Handler: "rpc",
		},
	}
}

// Client API for IndexProvider service

type IndexProviderService interface {
	Search(ctx context.Context, in *SearchIndexRequest, opts ...client.CallOption) (*SearchIndexResponse, error)
}

type indexProviderService struct {
	c    client.Client
	name string
}

func NewIndexProviderService(name string, c client.Client) IndexProviderService {
	return &indexProviderService{
		c:    c,
		name: name,
	}
}

func (c *indexProviderService) Search(ctx context.Context, in *SearchIndexRequest, opts ...client.CallOption) (*SearchIndexResponse, error) {
	req := c.c.NewRequest(c.name, "IndexProvider.Search", in)
	out := new(SearchIndexResponse)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for IndexProvider service

type IndexProviderHandler interface {
	Search(context.Context, *SearchIndexRequest, *SearchIndexResponse) error
}

func RegisterIndexProviderHandler(s server.Server, hdlr IndexProviderHandler, opts ...server.HandlerOption) error {
	type indexProvider interface {
		Search(ctx context.Context, in *SearchIndexRequest, out *SearchIndexResponse) error
	}
	type IndexProvider struct {
		indexProvider
	}
	h := &indexProviderHandler{hdlr}
	opts = append(opts, api.WithEndpoint(&api.Endpoint{
		Name:    "IndexProvider.Search",
		Path:    []string{"/api/v0/search/index/search"},
		Method:  []string{"POST"},
		Handler: "rpc",
	}))
	return s.Handle(s.NewHandler(&IndexProvider{h}, opts...))
}

type indexProviderHandler struct {
	IndexProviderHandler
}

func (h *indexProviderHandler) Search(ctx context.Context, in *SearchIndexRequest, out *SearchIndexResponse) error {
	return h.IndexProviderHandler.Search(ctx, in, out)
}
