// 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{}
)

// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#c661bbc4`.
// Forwards messages by their IDs.
//
// See https://core.telegram.org/method/messages.forwardMessages for reference.
type MessagesForwardMessagesRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to send messages silently (no notification will be triggered on the
	// destination clients)
	Silent bool
	// Whether to send the message in background
	Background bool
	// When forwarding games, whether to include your score in the game
	WithMyScore bool
	// Whether to forward messages without quoting the original author
	DropAuthor bool
	// Whether to strip captions from media
	DropMediaCaptions bool
	// Only for bots, disallows further re-forwarding and saving of the messages, even if the
	// destination chat doesn't have content protection¹ enabled
	//
	// Links:
	//  1) https://telegram.org/blog/protected-content-delete-by-date-and-more
	Noforwards bool
	// Source of messages
	FromPeer InputPeerClass
	// IDs of messages
	ID []int
	// Random ID to prevent resending of messages
	RandomID []int64
	// Destination peer
	ToPeer InputPeerClass
	// Destination forum topic¹
	//
	// Links:
	//  1) https://core.telegram.org/api/forum#forum-topics
	//
	// Use SetTopMsgID and GetTopMsgID helpers.
	TopMsgID int
	// Scheduled message date for scheduled messages
	//
	// Use SetScheduleDate and GetScheduleDate helpers.
	ScheduleDate int
	// Forward the messages as the specified peer
	//
	// Use SetSendAs and GetSendAs helpers.
	SendAs InputPeerClass
}

// MessagesForwardMessagesRequestTypeID is TL type id of MessagesForwardMessagesRequest.
const MessagesForwardMessagesRequestTypeID = 0xc661bbc4

// Ensuring interfaces in compile-time for MessagesForwardMessagesRequest.
var (
	_ bin.Encoder     = &MessagesForwardMessagesRequest{}
	_ bin.Decoder     = &MessagesForwardMessagesRequest{}
	_ bin.BareEncoder = &MessagesForwardMessagesRequest{}
	_ bin.BareDecoder = &MessagesForwardMessagesRequest{}
)

func ( *MessagesForwardMessagesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Silent == false) {
		return false
	}
	if !(.Background == false) {
		return false
	}
	if !(.WithMyScore == false) {
		return false
	}
	if !(.DropAuthor == false) {
		return false
	}
	if !(.DropMediaCaptions == false) {
		return false
	}
	if !(.Noforwards == false) {
		return false
	}
	if !(.FromPeer == nil) {
		return false
	}
	if !(.ID == nil) {
		return false
	}
	if !(.RandomID == nil) {
		return false
	}
	if !(.ToPeer == nil) {
		return false
	}
	if !(.TopMsgID == 0) {
		return false
	}
	if !(.ScheduleDate == 0) {
		return false
	}
	if !(.SendAs == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *MessagesForwardMessagesRequest) () string {
	if  == nil {
		return "MessagesForwardMessagesRequest(nil)"
	}
	type  MessagesForwardMessagesRequest
	return fmt.Sprintf("MessagesForwardMessagesRequest%+v", (*))
}

// FillFrom fills MessagesForwardMessagesRequest from given interface.
func ( *MessagesForwardMessagesRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( InputPeerClass)
	() ( []int)
	() ( []int64)
	() ( InputPeerClass)
	() ( int,  bool)
	() ( int,  bool)
	() ( InputPeerClass,  bool)
}) {
	.Silent = .()
	.Background = .()
	.WithMyScore = .()
	.DropAuthor = .()
	.DropMediaCaptions = .()
	.Noforwards = .()
	.FromPeer = .()
	.ID = .()
	.RandomID = .()
	.ToPeer = .()
	if ,  := .();  {
		.TopMsgID = 
	}

	if ,  := .();  {
		.ScheduleDate = 
	}

	if ,  := .();  {
		.SendAs = 
	}

}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*MessagesForwardMessagesRequest) () uint32 {
	return MessagesForwardMessagesRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*MessagesForwardMessagesRequest) () string {
	return "messages.forwardMessages"
}

// TypeInfo returns info about TL type.
func ( *MessagesForwardMessagesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.forwardMessages",
		ID:   MessagesForwardMessagesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Silent",
			SchemaName: "silent",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Background",
			SchemaName: "background",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "WithMyScore",
			SchemaName: "with_my_score",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "DropAuthor",
			SchemaName: "drop_author",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "DropMediaCaptions",
			SchemaName: "drop_media_captions",
			Null:       !.Flags.Has(12),
		},
		{
			Name:       "Noforwards",
			SchemaName: "noforwards",
			Null:       !.Flags.Has(14),
		},
		{
			Name:       "FromPeer",
			SchemaName: "from_peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "RandomID",
			SchemaName: "random_id",
		},
		{
			Name:       "ToPeer",
			SchemaName: "to_peer",
		},
		{
			Name:       "TopMsgID",
			SchemaName: "top_msg_id",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "ScheduleDate",
			SchemaName: "schedule_date",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "SendAs",
			SchemaName: "send_as",
			Null:       !.Flags.Has(13),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesForwardMessagesRequest) () {
	if !(.Silent == false) {
		.Flags.Set(5)
	}
	if !(.Background == false) {
		.Flags.Set(6)
	}
	if !(.WithMyScore == false) {
		.Flags.Set(8)
	}
	if !(.DropAuthor == false) {
		.Flags.Set(11)
	}
	if !(.DropMediaCaptions == false) {
		.Flags.Set(12)
	}
	if !(.Noforwards == false) {
		.Flags.Set(14)
	}
	if !(.TopMsgID == 0) {
		.Flags.Set(9)
	}
	if !(.ScheduleDate == 0) {
		.Flags.Set(10)
	}
	if !(.SendAs == nil) {
		.Flags.Set(13)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesForwardMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.forwardMessages#c661bbc4 as nil")
	}
	.PutID(MessagesForwardMessagesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesForwardMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.forwardMessages#c661bbc4 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field flags: %w", )
	}
	if .FromPeer == nil {
		return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field from_peer is nil")
	}
	if  := .FromPeer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field from_peer: %w", )
	}
	.PutVectorHeader(len(.ID))
	for ,  := range .ID {
		.PutInt()
	}
	.PutVectorHeader(len(.RandomID))
	for ,  := range .RandomID {
		.PutLong()
	}
	if .ToPeer == nil {
		return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field to_peer is nil")
	}
	if  := .ToPeer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field to_peer: %w", )
	}
	if .Flags.Has(9) {
		.PutInt(.TopMsgID)
	}
	if .Flags.Has(10) {
		.PutInt(.ScheduleDate)
	}
	if .Flags.Has(13) {
		if .SendAs == nil {
			return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field send_as is nil")
		}
		if  := .SendAs.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field send_as: %w", )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesForwardMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.forwardMessages#c661bbc4 to nil")
	}
	if  := .ConsumeID(MessagesForwardMessagesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesForwardMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.forwardMessages#c661bbc4 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field flags: %w", )
		}
	}
	.Silent = .Flags.Has(5)
	.Background = .Flags.Has(6)
	.WithMyScore = .Flags.Has(8)
	.DropAuthor = .Flags.Has(11)
	.DropMediaCaptions = .Flags.Has(12)
	.Noforwards = .Flags.Has(14)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field from_peer: %w", )
		}
		.FromPeer = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field id: %w", )
		}

		if  > 0 {
			.ID = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field random_id: %w", )
		}

		if  > 0 {
			.RandomID = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field random_id: %w", )
			}
			.RandomID = append(.RandomID, )
		}
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field to_peer: %w", )
		}
		.ToPeer = 
	}
	if .Flags.Has(9) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field top_msg_id: %w", )
		}
		.TopMsgID = 
	}
	if .Flags.Has(10) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field schedule_date: %w", )
		}
		.ScheduleDate = 
	}
	if .Flags.Has(13) {
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field send_as: %w", )
		}
		.SendAs = 
	}
	return nil
}

// SetSilent sets value of Silent conditional field.
func ( *MessagesForwardMessagesRequest) ( bool) {
	if  {
		.Flags.Set(5)
		.Silent = true
	} else {
		.Flags.Unset(5)
		.Silent = false
	}
}

// GetSilent returns value of Silent conditional field.
func ( *MessagesForwardMessagesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetBackground sets value of Background conditional field.
func ( *MessagesForwardMessagesRequest) ( bool) {
	if  {
		.Flags.Set(6)
		.Background = true
	} else {
		.Flags.Unset(6)
		.Background = false
	}
}

// GetBackground returns value of Background conditional field.
func ( *MessagesForwardMessagesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// SetWithMyScore sets value of WithMyScore conditional field.
func ( *MessagesForwardMessagesRequest) ( bool) {
	if  {
		.Flags.Set(8)
		.WithMyScore = true
	} else {
		.Flags.Unset(8)
		.WithMyScore = false
	}
}

// GetWithMyScore returns value of WithMyScore conditional field.
func ( *MessagesForwardMessagesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(8)
}

// SetDropAuthor sets value of DropAuthor conditional field.
func ( *MessagesForwardMessagesRequest) ( bool) {
	if  {
		.Flags.Set(11)
		.DropAuthor = true
	} else {
		.Flags.Unset(11)
		.DropAuthor = false
	}
}

// GetDropAuthor returns value of DropAuthor conditional field.
func ( *MessagesForwardMessagesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(11)
}

// SetDropMediaCaptions sets value of DropMediaCaptions conditional field.
func ( *MessagesForwardMessagesRequest) ( bool) {
	if  {
		.Flags.Set(12)
		.DropMediaCaptions = true
	} else {
		.Flags.Unset(12)
		.DropMediaCaptions = false
	}
}

// GetDropMediaCaptions returns value of DropMediaCaptions conditional field.
func ( *MessagesForwardMessagesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(12)
}

// SetNoforwards sets value of Noforwards conditional field.
func ( *MessagesForwardMessagesRequest) ( bool) {
	if  {
		.Flags.Set(14)
		.Noforwards = true
	} else {
		.Flags.Unset(14)
		.Noforwards = false
	}
}

// GetNoforwards returns value of Noforwards conditional field.
func ( *MessagesForwardMessagesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(14)
}

// GetFromPeer returns value of FromPeer field.
func ( *MessagesForwardMessagesRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .FromPeer
}

// GetID returns value of ID field.
func ( *MessagesForwardMessagesRequest) () ( []int) {
	if  == nil {
		return
	}
	return .ID
}

// GetRandomID returns value of RandomID field.
func ( *MessagesForwardMessagesRequest) () ( []int64) {
	if  == nil {
		return
	}
	return .RandomID
}

// GetToPeer returns value of ToPeer field.
func ( *MessagesForwardMessagesRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .ToPeer
}

// SetTopMsgID sets value of TopMsgID conditional field.
func ( *MessagesForwardMessagesRequest) ( int) {
	.Flags.Set(9)
	.TopMsgID = 
}

// GetTopMsgID returns value of TopMsgID conditional field and
// boolean which is true if field was set.
func ( *MessagesForwardMessagesRequest) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(9) {
		return , false
	}
	return .TopMsgID, true
}

// SetScheduleDate sets value of ScheduleDate conditional field.
func ( *MessagesForwardMessagesRequest) ( int) {
	.Flags.Set(10)
	.ScheduleDate = 
}

// GetScheduleDate returns value of ScheduleDate conditional field and
// boolean which is true if field was set.
func ( *MessagesForwardMessagesRequest) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .ScheduleDate, true
}

// SetSendAs sets value of SendAs conditional field.
func ( *MessagesForwardMessagesRequest) ( InputPeerClass) {
	.Flags.Set(13)
	.SendAs = 
}

// GetSendAs returns value of SendAs conditional field and
// boolean which is true if field was set.
func ( *MessagesForwardMessagesRequest) () ( InputPeerClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(13) {
		return , false
	}
	return .SendAs, true
}

// MessagesForwardMessages invokes method messages.forwardMessages#c661bbc4 returning error if any.
// Forwards messages by their IDs.
//
// Possible errors:
//
//	400 BROADCAST_PUBLIC_VOTERS_FORBIDDEN: You can't forward polls with public voters.
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	406 CHAT_FORWARDS_RESTRICTED: You can't forward messages from a protected chat.
//	403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info.
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//	400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted.
//	403 CHAT_SEND_AUDIOS_FORBIDDEN: You can't send audio messages in this chat.
//	403 CHAT_SEND_DOCS_FORBIDDEN: You can't send documents in this chat.
//	403 CHAT_SEND_GAME_FORBIDDEN: You can't send a game to this chat.
//	403 CHAT_SEND_GIFS_FORBIDDEN: You can't send gifs in this chat.
//	403 CHAT_SEND_MEDIA_FORBIDDEN: You can't send media in this chat.
//	403 CHAT_SEND_PHOTOS_FORBIDDEN: You can't send photos in this chat.
//	403 CHAT_SEND_PLAIN_FORBIDDEN: You can't send non-media (text) messages in this chat.
//	403 CHAT_SEND_POLL_FORBIDDEN: You can't send polls in this chat.
//	403 CHAT_SEND_STICKERS_FORBIDDEN: You can't send stickers in this chat.
//	403 CHAT_SEND_VIDEOS_FORBIDDEN: You can't send videos in this chat.
//	403 CHAT_SEND_VOICES_FORBIDDEN: You can't send voice recordings in this chat.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 GROUPED_MEDIA_INVALID: Invalid grouped media.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 MEDIA_EMPTY: The provided media object is invalid.
//	400 MESSAGE_IDS_EMPTY: No message ids were provided.
//	400 MESSAGE_ID_INVALID: The provided message id is invalid.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	406 PAYMENT_UNSUPPORTED: A detailed description of the error will be received separately as described here ».
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 QUIZ_ANSWER_MISSING: You can forward a quiz while hiding the original author only after choosing an option in the quiz.
//	500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used.
//	400 RANDOM_ID_INVALID: A provided random ID is invalid.
//	400 SCHEDULE_DATE_TOO_LATE: You can't schedule a message this far in the future.
//	400 SCHEDULE_TOO_MUCH: There are too many scheduled messages.
//	400 SEND_AS_PEER_INVALID: You can't send messages as the specified peer.
//	400 SLOWMODE_MULTI_MSGS_DISABLED: Slowmode is enabled, you cannot forward multiple messages to this group.
//	420 SLOWMODE_WAIT_%d: Slowmode is enabled in this chat: wait %d seconds before sending another message to this chat.
//	406 TOPIC_CLOSED: This topic was closed, you can't send messages to it anymore.
//	406 TOPIC_DELETED: The specified topic was deleted.
//	400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels.
//	403 USER_IS_BLOCKED: You were blocked by this user.
//	400 USER_IS_BOT: Bots can't send messages to other bots.
//	403 VOICE_MESSAGES_FORBIDDEN: This user's privacy settings forbid you from sending voice messages.
//	400 YOU_BLOCKED_USER: You blocked this user.
//
// See https://core.telegram.org/method/messages.forwardMessages for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesForwardMessagesRequest) (UpdatesClass, error) {
	var  UpdatesBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Updates, nil
}