// 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 (
	CreateEventType = "PredictionEventCreate"
)

type Create = PredictionEventCreate

type PredictionEventCreateHandler func(context.Context, *eventbus.Header, *PredictionEventCreate) error

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

func RegisterPredictionEventCreateHandler(mux *eventbus.Mux, f PredictionEventCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f PredictionEventCreateHandler) {
	RegisterPredictionEventCreateHandler(mux, f)
}

func (*PredictionEventCreate) EventBusName() string {
	return CreateEventType
}
