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

package v0

import (
	fmt "fmt"
	_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
	_ "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/eventhistory/v0"
	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 EventHistoryService service

func NewEventHistoryServiceEndpoints() []*api.Endpoint {
	return []*api.Endpoint{}
}

// Client API for EventHistoryService service

type EventHistoryService interface {
	// returns the specified events
	GetEvents(ctx context.Context, in *GetEventsRequest, opts ...client.CallOption) (*GetEventsResponse, error)
	// returns all events for the specified userID
	GetEventsForUser(ctx context.Context, in *GetEventsForUserRequest, opts ...client.CallOption) (*GetEventsResponse, error)
}

type eventHistoryService struct {
	c    client.Client
	name string
}

func NewEventHistoryService(name string, c client.Client) EventHistoryService {
	return &eventHistoryService{
		c:    c,
		name: name,
	}
}

func (c *eventHistoryService) GetEvents(ctx context.Context, in *GetEventsRequest, opts ...client.CallOption) (*GetEventsResponse, error) {
	req := c.c.NewRequest(c.name, "EventHistoryService.GetEvents", in)
	out := new(GetEventsResponse)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *eventHistoryService) GetEventsForUser(ctx context.Context, in *GetEventsForUserRequest, opts ...client.CallOption) (*GetEventsResponse, error) {
	req := c.c.NewRequest(c.name, "EventHistoryService.GetEventsForUser", in)
	out := new(GetEventsResponse)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for EventHistoryService service

type EventHistoryServiceHandler interface {
	// returns the specified events
	GetEvents(context.Context, *GetEventsRequest, *GetEventsResponse) error
	// returns all events for the specified userID
	GetEventsForUser(context.Context, *GetEventsForUserRequest, *GetEventsResponse) error
}

func RegisterEventHistoryServiceHandler(s server.Server, hdlr EventHistoryServiceHandler, opts ...server.HandlerOption) error {
	type eventHistoryService interface {
		GetEvents(ctx context.Context, in *GetEventsRequest, out *GetEventsResponse) error
		GetEventsForUser(ctx context.Context, in *GetEventsForUserRequest, out *GetEventsResponse) error
	}
	type EventHistoryService struct {
		eventHistoryService
	}
	h := &eventHistoryServiceHandler{hdlr}
	return s.Handle(s.NewHandler(&EventHistoryService{h}, opts...))
}

type eventHistoryServiceHandler struct {
	EventHistoryServiceHandler
}

func (h *eventHistoryServiceHandler) GetEvents(ctx context.Context, in *GetEventsRequest, out *GetEventsResponse) error {
	return h.EventHistoryServiceHandler.GetEvents(ctx, in, out)
}

func (h *eventHistoryServiceHandler) GetEventsForUser(ctx context.Context, in *GetEventsForUserRequest, out *GetEventsResponse) error {
	return h.EventHistoryServiceHandler.GetEventsForUser(ctx, in, out)
}
