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

package subscriber_badge

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "SubscriberBadgeCreate"
)

type Create = SubscriberBadgeCreate

type SubscriberBadgeCreateHandler func(context.Context, *eventbus.Header, *SubscriberBadgeCreate) error

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

func RegisterSubscriberBadgeCreateHandler(mux *eventbus.Mux, f SubscriberBadgeCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f SubscriberBadgeCreateHandler) {
	RegisterSubscriberBadgeCreateHandler(mux, f)
}

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