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

package user_social_media_link

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "UserSocialMediaLinkUpdate"
)

type Update = UserSocialMediaLinkUpdate

type UserSocialMediaLinkUpdateHandler func(context.Context, *eventbus.Header, *UserSocialMediaLinkUpdate) error

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

func RegisterUserSocialMediaLinkUpdateHandler(mux *eventbus.Mux, f UserSocialMediaLinkUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f UserSocialMediaLinkUpdateHandler) {
	RegisterUserSocialMediaLinkUpdateHandler(mux, f)
}

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