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

package subscriber_badge_flair

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "SubscriberBadgeFlairCreate"
)

type Create = SubscriberBadgeFlairCreate

type SubscriberBadgeFlairCreateHandler func(context.Context, *eventbus.Header, *SubscriberBadgeFlairCreate) error

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

func RegisterSubscriberBadgeFlairCreateHandler(mux *eventbus.Mux, f SubscriberBadgeFlairCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f SubscriberBadgeFlairCreateHandler) {
	RegisterSubscriberBadgeFlairCreateHandler(mux, f)
}

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