// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

func ( UpdateClass) (,  int,  bool) {
	switch u := .(type) {
	case *UpdateNewMessage:
		return .Pts, .PtsCount, true
	case *UpdateDeleteMessages:
		return .Pts, .PtsCount, true
	case *UpdateReadHistoryInbox:
		return .Pts, .PtsCount, true
	case *UpdateReadHistoryOutbox:
		return .Pts, .PtsCount, true
	case *UpdateWebPage:
		return .Pts, .PtsCount, true
	case *UpdateReadMessagesContents:
		return .Pts, .PtsCount, true
	case *UpdateEditMessage:
		return .Pts, .PtsCount, true
	case *UpdateFolderPeers:
		return .Pts, .PtsCount, true
	case *UpdatePinnedMessages:
		return .Pts, .PtsCount, true
	}

	return
}

func ( UpdateClass) ( int,  bool) {
	switch u := .(type) {
	case *UpdateNewEncryptedMessage:
		return .Qts, true
	case *UpdateMessagePollVote:
		return .Qts, true
	case *UpdateChatParticipant:
		return .Qts, true
	case *UpdateChannelParticipant:
		return .Qts, true
	case *UpdateBotStopped:
		return .Qts, true
	case *UpdateBotChatInviteRequester:
		return .Qts, true
	case *UpdateBotChatBoost:
		return .Qts, true
	case *UpdateBotMessageReaction:
		return .Qts, true
	case *UpdateBotMessageReactions:
		return .Qts, true
	}

	return
}

func ( UpdateClass) ( int64, ,  int,  bool,  error) {
	switch u := .(type) {
	case *UpdateChannelTooLong:
		return .ChannelID, .Pts, 0, true, nil
	case *UpdateNewChannelMessage:
		,  = extractChannelID(.Message)
		return , .Pts, .PtsCount, true, 
	case *UpdateReadChannelInbox:
		return .ChannelID, .Pts, 0, true, nil
	case *UpdateDeleteChannelMessages:
		return .ChannelID, .Pts, .PtsCount, true, nil
	case *UpdateEditChannelMessage:
		,  = extractChannelID(.Message)
		return , .Pts, .PtsCount, true, 
	case *UpdateChannelWebPage:
		return .ChannelID, .Pts, .PtsCount, true, nil
	case *UpdatePinnedChannelMessages:
		return .ChannelID, .Pts, .PtsCount, true, nil
	}

	return
}

func ( MessageClass) (int64, error) {
	switch msg := .(type) {
	case *MessageEmpty:
		,  := .GetPeerID()
		if ! {
			return 0, errors.New("MessageEmpty have no peerID field")
		}
		if ,  := .(*PeerChannel);  {
			return .ChannelID, nil
		}

		return 0, errors.New("unexpected peer type")
	case *Message:
		 := .PeerID

		if ,  := .(*PeerChannel);  {
			return .ChannelID, nil
		}

		return 0, errors.New("unexpected peer type")
	case *MessageService:
		 := .PeerID

		if ,  := .(*PeerChannel);  {
			return .ChannelID, nil
		}

		return 0, errors.New("unexpected peer type")
	default:
		return 0, errors.New("unexpected MessageClass type")
	}
}