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

package channel_endorsement_list

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "ChannelEndorsementListUpdate"
)

type Update = ChannelEndorsementListUpdate

type ChannelEndorsementListUpdateHandler func(context.Context, *eventbus.Header, *ChannelEndorsementListUpdate) error

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

func RegisterChannelEndorsementListUpdateHandler(mux *eventbus.Mux, f ChannelEndorsementListUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f ChannelEndorsementListUpdateHandler) {
	RegisterChannelEndorsementListUpdateHandler(mux, f)
}

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