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

package user_ban

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "UserBanCreate"
)

type Create = UserBanCreate

type UserBanCreateHandler func(context.Context, *eventbus.Header, *UserBanCreate) error

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

func RegisterUserBanCreateHandler(mux *eventbus.Mux, f UserBanCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f UserBanCreateHandler) {
	RegisterUserBanCreateHandler(mux, f)
}

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