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

package channel_brand_safety

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "ChannelBrandSafetyUpdate"
)

type Update = ChannelBrandSafetyUpdate

type ChannelBrandSafetyUpdateHandler func(context.Context, *eventbus.Header, *ChannelBrandSafetyUpdate) error

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

func RegisterChannelBrandSafetyUpdateHandler(mux *eventbus.Mux, f ChannelBrandSafetyUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f ChannelBrandSafetyUpdateHandler) {
	RegisterChannelBrandSafetyUpdateHandler(mux, f)
}

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