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

package creator_subscription_settings

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "CreatorSubscriptionSettingsUpdate"
)

type Update = CreatorSubscriptionSettingsUpdate

type CreatorSubscriptionSettingsUpdateHandler func(context.Context, *eventbus.Header, *CreatorSubscriptionSettingsUpdate) error

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

func RegisterCreatorSubscriptionSettingsUpdateHandler(mux *eventbus.Mux, f CreatorSubscriptionSettingsUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f CreatorSubscriptionSettingsUpdateHandler) {
	RegisterCreatorSubscriptionSettingsUpdateHandler(mux, f)
}

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