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

package ads_creator_incentive_offer_set

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	CreateEventType = "AdsCreatorIncentiveOfferSetCreate"
)

type Create = AdsCreatorIncentiveOfferSetCreate

type AdsCreatorIncentiveOfferSetCreateHandler func(context.Context, *eventbus.Header, *AdsCreatorIncentiveOfferSetCreate) error

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

func RegisterAdsCreatorIncentiveOfferSetCreateHandler(mux *eventbus.Mux, f AdsCreatorIncentiveOfferSetCreateHandler) {
	mux.RegisterHandler(CreateEventType, f.Handler())
}

func RegisterCreateHandler(mux *eventbus.Mux, f AdsCreatorIncentiveOfferSetCreateHandler) {
	RegisterAdsCreatorIncentiveOfferSetCreateHandler(mux, f)
}

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