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

package user_password

import (
	"context"

	"github.com/golang/protobuf/proto"

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

const (
	UpdateEventType = "UserPasswordUpdate"
)

type Update = UserPasswordUpdate

type UserPasswordUpdateHandler func(context.Context, *eventbus.Header, *UserPasswordUpdate) error

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

func RegisterUserPasswordUpdateHandler(mux *eventbus.Mux, f UserPasswordUpdateHandler) {
	mux.RegisterHandler(UpdateEventType, f.Handler())
}

func RegisterUpdateHandler(mux *eventbus.Mux, f UserPasswordUpdateHandler) {
	RegisterUserPasswordUpdateHandler(mux, f)
}

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