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

package prediction_event

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "PredictionEventUpdate"
)

type Update = PredictionEventUpdate

type PredictionEventUpdateHandler func(context.Context, *eventbus.Header, *PredictionEventUpdate) error

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

func RegisterPredictionEventUpdateHandler(mux *eventbus.Mux, f PredictionEventUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f PredictionEventUpdateHandler) {
	RegisterPredictionEventUpdateHandler(mux, f)
}

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