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

package creator_goal

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "CreatorGoalCreate"
)

type Create = CreatorGoalCreate

type CreatorGoalCreateHandler func(context.Context, *eventbus.Header, *CreatorGoalCreate) error

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

func RegisterCreatorGoalCreateHandler(mux *eventbus.Mux, f CreatorGoalCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f CreatorGoalCreateHandler) {
	RegisterCreatorGoalCreateHandler(mux, f)
}

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