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

package bounty_status

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "BountyStatusUpdate"
)

type Update = BountyStatusUpdate

type BountyStatusUpdateHandler func(context.Context, *eventbus.Header, *BountyStatusUpdate) error

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

func RegisterBountyStatusUpdateHandler(mux *eventbus.Mux, f BountyStatusUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f BountyStatusUpdateHandler) {
	RegisterBountyStatusUpdateHandler(mux, f)
}

func (*BountyStatusUpdate) EventBusName() string {
	return UpdateEventType
}
