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

package authorization

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "AuthorizationCreate"
)

type Create = AuthorizationCreate

type AuthorizationCreateHandler func(context.Context, *eventbus.Header, *AuthorizationCreate) error

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

func RegisterAuthorizationCreateHandler(mux *eventbus.Mux, f AuthorizationCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f AuthorizationCreateHandler) {
	RegisterAuthorizationCreateHandler(mux, f)
}

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