// 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 (
	DeleteEventType = "CategoryDelete"
)

type Delete = CategoryDelete

type CategoryDeleteHandler func(context.Context, *eventbus.Header, *CategoryDelete) error

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

func RegisterCategoryDeleteHandler(mux *eventbus.Mux, f CategoryDeleteHandler) {
	mux.RegisterHandler(DeleteEventType, f.Handler())
}

func RegisterDeleteHandler(mux *eventbus.Mux, f CategoryDeleteHandler) {
	RegisterCategoryDeleteHandler(mux, f)
}

func (*CategoryDelete) EventBusName() string {
	return DeleteEventType
}
