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

package entitlement_emote

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "EntitlementEmoteUpdate"
)

type Update = EntitlementEmoteUpdate

type EntitlementEmoteUpdateHandler func(context.Context, *eventbus.Header, *EntitlementEmoteUpdate) error

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

func RegisterEntitlementEmoteUpdateHandler(mux *eventbus.Mux, f EntitlementEmoteUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f EntitlementEmoteUpdateHandler) {
	RegisterEntitlementEmoteUpdateHandler(mux, f)
}

func (*EntitlementEmoteUpdate) EventBusName() string {
	return UpdateEventType
}
