// NOTE this is a generated file! do not edit!

package igdb_game

import (
	"context"

	"github.com/golang/protobuf/proto"

	eventbus "code.justin.tv/eventbus/client"
)

const (
	UpdateEventType = "IgdbGameUpdate"
)

type Update = IgdbGameUpdate

type IgdbGameUpdateHandler func(context.Context, *eventbus.Header, *IgdbGameUpdate) error

func (h IgdbGameUpdateHandler) Handler() eventbus.Handler {
	return func(ctx context.Context, message eventbus.RawMessage) error {
		dst := &IgdbGameUpdate{}
		err := proto.Unmarshal(message.Payload, dst)
		if err != nil {
			return err
		}
		return h(ctx, message.Header, dst)
	}
}

func RegisterIgdbGameUpdateHandler(mux *eventbus.Mux, f IgdbGameUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f IgdbGameUpdateHandler) {
	RegisterIgdbGameUpdateHandler(mux, f)
}

func (*IgdbGameUpdate) EventBusName() string {
	return UpdateEventType
}
