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

package chat_moderation_action

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "ChatModerationActionCreate"
)

type Create = ChatModerationActionCreate

type ChatModerationActionCreateHandler func(context.Context, *eventbus.Header, *ChatModerationActionCreate) error

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

func RegisterChatModerationActionCreateHandler(mux *eventbus.Mux, f ChatModerationActionCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f ChatModerationActionCreateHandler) {
	RegisterChatModerationActionCreateHandler(mux, f)
}

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