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

package promotion_impression

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "PromotionImpressionCreate"
)

type Create = PromotionImpressionCreate

type PromotionImpressionCreateHandler func(context.Context, *eventbus.Header, *PromotionImpressionCreate) error

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

func RegisterPromotionImpressionCreateHandler(mux *eventbus.Mux, f PromotionImpressionCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f PromotionImpressionCreateHandler) {
	RegisterPromotionImpressionCreateHandler(mux, f)
}

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