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

type Create = ChannelPointsCustomRewardCreate

type ChannelPointsCustomRewardCreateHandler func(context.Context, *eventbus.Header, *ChannelPointsCustomRewardCreate) error

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

func RegisterChannelPointsCustomRewardCreateHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f ChannelPointsCustomRewardCreateHandler) {
	RegisterChannelPointsCustomRewardCreateHandler(mux, f)
}

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