// Code generated by protoc-gen-gpbrpc-go.
// source: lsd.proto
// DO NOT EDIT!

package lsd

import "github.com/gogo/protobuf/proto"
import "badoo/_packages/gpbrpc"
import "fmt"

type GpbrpcType struct {
}

var Gpbrpc GpbrpcType

var RequestMsgid_gpbrpc_name = map[uint32]string{
	1: "request_new_events",
}

var RequestMsgid_gpbrpc_value = map[string]uint32{
	"request_new_events": 1,
}

var ResponseMsgid_gpbrpc_name = map[uint32]string{
	1: "response_generic",
	2: "response_offsets",
}

var ResponseMsgid_gpbrpc_value = map[string]uint32{
	"response_generic": 1,
	"response_offsets": 2,
}

func (GpbrpcType) GetRequestMsgid(msg proto.Message) uint32 {
	switch msg.(type) {
	case *RequestNewEvents:
		return uint32(RequestMsgid_REQUEST_NEW_EVENTS)
	default:
		panic("you gave me the wrong message")
	}
}

func (GpbrpcType) GetRequestNameToIdMap() map[string]uint32 {
	return RequestMsgid_gpbrpc_value
}

func (GpbrpcType) GetRequestIdToNameMap() map[uint32]string {
	return RequestMsgid_gpbrpc_name
}

func (GpbrpcType) GetResponseNameToIdMap() map[string]uint32 {
	return ResponseMsgid_gpbrpc_value
}

func (GpbrpcType) GetResponseIdToNameMap() map[uint32]string {
	return ResponseMsgid_gpbrpc_name
}

func (GpbrpcType) GetResponseMsgid(msg proto.Message) uint32 {
	switch msg.(type) {
	case *ResponseGeneric:
		return uint32(ResponseMsgid_RESPONSE_GENERIC)
	case *ResponseOffsets:
		return uint32(ResponseMsgid_RESPONSE_OFFSETS)
	default:
		panic("you gave me the wrong message")
	}
}

func (GpbrpcType) GetPackageName() string {
	return "lsd"
}

func (GpbrpcType) GetRequestMsg(request_msgid uint32) proto.Message {
	switch RequestMsgid(request_msgid) {
	case RequestMsgid_REQUEST_NEW_EVENTS:
		return &RequestNewEvents{}
	default:
		return nil
	}
}

func (GpbrpcType) GetResponseMsg(response_msgid uint32) proto.Message {
	switch ResponseMsgid(response_msgid) {
	case ResponseMsgid_RESPONSE_GENERIC:
		return &ResponseGeneric{}
	case ResponseMsgid_RESPONSE_OFFSETS:
		return &ResponseOffsets{}
	default:
		return nil
	}
}

type GpbrpcInterface interface {
	RequestNewEvents(rctx gpbrpc.RequestT, request *RequestNewEvents) gpbrpc.ResultT
}

func (GpbrpcType) Dispatch(rctx gpbrpc.RequestT, abstract_service interface{}) gpbrpc.ResultT {

	service := abstract_service.(GpbrpcInterface)

	switch RequestMsgid(rctx.MessageId) {
	case RequestMsgid_REQUEST_NEW_EVENTS:
		r := rctx.Message.(*RequestNewEvents)
		return service.RequestNewEvents(rctx, r)
	default:
		panic("screw you")
	}
}

var okResult = gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(0)})

func (GpbrpcType) OK(args ...interface{}) gpbrpc.ResultT {
	if len(args) == 0 {
		return okResult
	}
	return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(0),
		ErrorText: proto.String(fmt.Sprint(args...))})
}

func (GpbrpcType) ErrorGeneric(args ...interface{}) gpbrpc.ResultT {
	return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_GENERIC)),
		ErrorText: proto.String(fmt.Sprint(args...))})
}

/*
	func ($receiver$) RequestNewEvents(rctx gpbrpc.RequestT, request *$proto$.RequestNewEvents) gpbrpc.ResultT {
		return $proto$.Gpbrpc.ErrorGeneric("not implemented")
	}

*/
