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

package active_subscription

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	DeleteEventType = "ActiveSubscriptionDelete"
)

type Delete = ActiveSubscriptionDelete

type ActiveSubscriptionDeleteHandler func(context.Context, *eventbus.Header, *ActiveSubscriptionDelete) error

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

func RegisterActiveSubscriptionDeleteHandler(mux *eventbus.Mux, f ActiveSubscriptionDeleteHandler) {
	mux.RegisterHandler(DeleteEventType, f.Handler())
}

func RegisterDeleteHandler(mux *eventbus.Mux, f ActiveSubscriptionDeleteHandler) {
	RegisterActiveSubscriptionDeleteHandler(mux, f)
}

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