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

package entitlement_subscription

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	DeleteEventType = "EntitlementSubscriptionDelete"
)

type Delete = EntitlementSubscriptionDelete

type EntitlementSubscriptionDeleteHandler func(context.Context, *eventbus.Header, *EntitlementSubscriptionDelete) error

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

func RegisterEntitlementSubscriptionDeleteHandler(mux *eventbus.Mux, f EntitlementSubscriptionDeleteHandler) {
	mux.RegisterHandler(DeleteEventType, f.Handler())
}

func RegisterDeleteHandler(mux *eventbus.Mux, f EntitlementSubscriptionDeleteHandler) {
	RegisterEntitlementSubscriptionDeleteHandler(mux, f)
}

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