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

package raid

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "RaidUpdate"
)

type Update = RaidUpdate

type RaidUpdateHandler func(context.Context, *eventbus.Header, *RaidUpdate) error

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

func RegisterRaidUpdateHandler(mux *eventbus.Mux, f RaidUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f RaidUpdateHandler) {
	RegisterRaidUpdateHandler(mux, f)
}

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