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

package channel_points_custom_reward

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	DeleteEventType = "ChannelPointsCustomRewardDelete"
)

type Delete = ChannelPointsCustomRewardDelete

type ChannelPointsCustomRewardDeleteHandler func(context.Context, *eventbus.Header, *ChannelPointsCustomRewardDelete) error

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

func RegisterChannelPointsCustomRewardDeleteHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardDeleteHandler) {
	mux.RegisterHandler(DeleteEventType, f.Handler())
}

func RegisterDeleteHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardDeleteHandler) {
	RegisterChannelPointsCustomRewardDeleteHandler(mux, f)
}

func (*ChannelPointsCustomRewardDelete) EventBusName() string {
	return DeleteEventType
}
