// 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 (
	DeleteEventType = "AuthorizationDelete"
)

type Delete = AuthorizationDelete

type AuthorizationDeleteHandler func(context.Context, *eventbus.Header, *AuthorizationDelete) error

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

func RegisterAuthorizationDeleteHandler(mux *eventbus.Mux, f AuthorizationDeleteHandler) {
	mux.RegisterHandler(DeleteEventType, f.Handler())
}

func RegisterDeleteHandler(mux *eventbus.Mux, f AuthorizationDeleteHandler) {
	RegisterAuthorizationDeleteHandler(mux, f)
}

func (*AuthorizationDelete) EventBusName() string {
	return DeleteEventType
}
