// 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 (
	CreateEventType = "ChannelPointsCustomRewardRedemptionCreate"
)

type Create = ChannelPointsCustomRewardRedemptionCreate

type ChannelPointsCustomRewardRedemptionCreateHandler func(context.Context, *eventbus.Header, *ChannelPointsCustomRewardRedemptionCreate) error

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

func RegisterChannelPointsCustomRewardRedemptionCreateHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardRedemptionCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardRedemptionCreateHandler) {
	RegisterChannelPointsCustomRewardRedemptionCreateHandler(mux, f)
}

func (*ChannelPointsCustomRewardRedemptionCreate) EventBusName() string {
	return CreateEventType
}
