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

package category

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "CategoryCreate"
)

type Create = CategoryCreate

type CategoryCreateHandler func(context.Context, *eventbus.Header, *CategoryCreate) error

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

func RegisterCategoryCreateHandler(mux *eventbus.Mux, f CategoryCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f CategoryCreateHandler) {
	RegisterCategoryCreateHandler(mux, f)
}

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