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

type Create = TagCreate

type TagCreateHandler func(context.Context, *eventbus.Header, *TagCreate) error

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

func RegisterTagCreateHandler(mux *eventbus.Mux, f TagCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f TagCreateHandler) {
	RegisterTagCreateHandler(mux, f)
}

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