package mtproto

import (
	
	

	
	
	
)

func ( *Conn) ( int64,  *bin.Buffer) error {
	,  := .PeekID()
	if  != nil {
		// Empty body.
		return errors.Wrap(, "peek message type")
	}

	.logWithBuffer().Debug("Handle message", zap.Int64("msg_id", ))
	switch  {
	case mt.NewSessionCreatedTypeID:
		return .handleSessionCreated()
	case mt.BadMsgNotificationTypeID, mt.BadServerSaltTypeID:
		return .handleBadMsg()
	case mt.FutureSaltsTypeID:
		return .handleFutureSalts()
	case proto.MessageContainerTypeID:
		return .handleContainer(, )
	case proto.ResultTypeID:
		return .handleResult()
	case mt.PongTypeID:
		return .handlePong()
	case mt.MsgsAckTypeID:
		return .handleAck()
	case proto.GZIPTypeID:
		return .handleGZIP(, )
	case mt.MsgDetailedInfoTypeID,
		mt.MsgNewDetailedInfoTypeID:
		return nil
	default:
		return .handler.OnMessage()
	}
}