// 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 (
	UpdateEventType = "CreatorGoalUpdate"
)

type Update = CreatorGoalUpdate

type CreatorGoalUpdateHandler func(context.Context, *eventbus.Header, *CreatorGoalUpdate) error

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

func RegisterCreatorGoalUpdateHandler(mux *eventbus.Mux, f CreatorGoalUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f CreatorGoalUpdateHandler) {
	RegisterCreatorGoalUpdateHandler(mux, f)
}

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