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

package tag

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "TagUpdate"
)

type Update = TagUpdate

type TagUpdateHandler func(context.Context, *eventbus.Header, *TagUpdate) error

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

func RegisterTagUpdateHandler(mux *eventbus.Mux, f TagUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f TagUpdateHandler) {
	RegisterTagUpdateHandler(mux, f)
}

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