// 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 (
	CreateEventType = "ActiveSubscriptionCreate"
)

type Create = ActiveSubscriptionCreate

type ActiveSubscriptionCreateHandler func(context.Context, *eventbus.Header, *ActiveSubscriptionCreate) error

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

func RegisterActiveSubscriptionCreateHandler(mux *eventbus.Mux, f ActiveSubscriptionCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f ActiveSubscriptionCreateHandler) {
	RegisterActiveSubscriptionCreateHandler(mux, f)
}

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