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

package channel_points_custom_reward_redemption

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "ChannelPointsCustomRewardRedemptionUpdate"
)

type Update = ChannelPointsCustomRewardRedemptionUpdate

type ChannelPointsCustomRewardRedemptionUpdateHandler func(context.Context, *eventbus.Header, *ChannelPointsCustomRewardRedemptionUpdate) error

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

func RegisterChannelPointsCustomRewardRedemptionUpdateHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardRedemptionUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardRedemptionUpdateHandler) {
	RegisterChannelPointsCustomRewardRedemptionUpdateHandler(mux, f)
}

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