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

package channel_moderator

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "ChannelModeratorCreate"
)

type Create = ChannelModeratorCreate

type ChannelModeratorCreateHandler func(context.Context, *eventbus.Header, *ChannelModeratorCreate) error

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

func RegisterChannelModeratorCreateHandler(mux *eventbus.Mux, f ChannelModeratorCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f ChannelModeratorCreateHandler) {
	RegisterChannelModeratorCreateHandler(mux, f)
}

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