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

// MessagesGetExportedChatInvitesRequest represents TL type `messages.getExportedChatInvites#a2b5a3f6`.
// Get info about the chat invites of a specific chat
//
// See https://core.telegram.org/method/messages.getExportedChatInvites for reference.
type MessagesGetExportedChatInvitesRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to fetch revoked chat invites
	Revoked bool
	// Chat
	Peer InputPeerClass
	// Whether to only fetch chat invites from this admin
	AdminID InputUserClass
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	//
	// Use SetOffsetDate and GetOffsetDate helpers.
	OffsetDate int
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	//
	// Use SetOffsetLink and GetOffsetLink helpers.
	OffsetLink string
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// MessagesGetExportedChatInvitesRequestTypeID is TL type id of MessagesGetExportedChatInvitesRequest.
const MessagesGetExportedChatInvitesRequestTypeID = 0xa2b5a3f6

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

func ( *MessagesGetExportedChatInvitesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Revoked == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.AdminID == nil) {
		return false
	}
	if !(.OffsetDate == 0) {
		return false
	}
	if !(.OffsetLink == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetExportedChatInvitesRequest from given interface.
func ( *MessagesGetExportedChatInvitesRequest) ( interface {
	() ( bool)
	() ( InputPeerClass)
	() ( InputUserClass)
	() ( int,  bool)
	() ( string,  bool)
	() ( int)
}) {
	.Revoked = .()
	.Peer = .()
	.AdminID = .()
	if ,  := .();  {
		.OffsetDate = 
	}

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

	.Limit = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetExportedChatInvitesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getExportedChatInvites",
		ID:   MessagesGetExportedChatInvitesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Revoked",
			SchemaName: "revoked",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "AdminID",
			SchemaName: "admin_id",
		},
		{
			Name:       "OffsetDate",
			SchemaName: "offset_date",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "OffsetLink",
			SchemaName: "offset_link",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesGetExportedChatInvitesRequest) () {
	if !(.Revoked == false) {
		.Flags.Set(3)
	}
	if !(.OffsetDate == 0) {
		.Flags.Set(2)
	}
	if !(.OffsetLink == "") {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesGetExportedChatInvitesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getExportedChatInvites#a2b5a3f6 as nil")
	}
	.PutID(MessagesGetExportedChatInvitesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetExportedChatInvitesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getExportedChatInvites#a2b5a3f6 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvites#a2b5a3f6: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvites#a2b5a3f6: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvites#a2b5a3f6: field peer: %w", )
	}
	if .AdminID == nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvites#a2b5a3f6: field admin_id is nil")
	}
	if  := .AdminID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvites#a2b5a3f6: field admin_id: %w", )
	}
	if .Flags.Has(2) {
		.PutInt(.OffsetDate)
	}
	if .Flags.Has(2) {
		.PutString(.OffsetLink)
	}
	.PutInt(.Limit)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetExportedChatInvitesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getExportedChatInvites#a2b5a3f6 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvites#a2b5a3f6: field flags: %w", )
		}
	}
	.Revoked = .Flags.Has(3)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvites#a2b5a3f6: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvites#a2b5a3f6: field admin_id: %w", )
		}
		.AdminID = 
	}
	if .Flags.Has(2) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvites#a2b5a3f6: field offset_date: %w", )
		}
		.OffsetDate = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvites#a2b5a3f6: field offset_link: %w", )
		}
		.OffsetLink = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvites#a2b5a3f6: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// SetRevoked sets value of Revoked conditional field.
func ( *MessagesGetExportedChatInvitesRequest) ( bool) {
	if  {
		.Flags.Set(3)
		.Revoked = true
	} else {
		.Flags.Unset(3)
		.Revoked = false
	}
}

// GetRevoked returns value of Revoked conditional field.
func ( *MessagesGetExportedChatInvitesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// GetPeer returns value of Peer field.
func ( *MessagesGetExportedChatInvitesRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetAdminID returns value of AdminID field.
func ( *MessagesGetExportedChatInvitesRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .AdminID
}

// SetOffsetDate sets value of OffsetDate conditional field.
func ( *MessagesGetExportedChatInvitesRequest) ( int) {
	.Flags.Set(2)
	.OffsetDate = 
}

// GetOffsetDate returns value of OffsetDate conditional field and
// boolean which is true if field was set.
func ( *MessagesGetExportedChatInvitesRequest) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .OffsetDate, true
}

// SetOffsetLink sets value of OffsetLink conditional field.
func ( *MessagesGetExportedChatInvitesRequest) ( string) {
	.Flags.Set(2)
	.OffsetLink = 
}

// GetOffsetLink returns value of OffsetLink conditional field and
// boolean which is true if field was set.
func ( *MessagesGetExportedChatInvitesRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .OffsetLink, true
}

// GetLimit returns value of Limit field.
func ( *MessagesGetExportedChatInvitesRequest) () ( int) {
	if  == nil {
		return
	}
	return .Limit
}

// MessagesGetExportedChatInvites invokes method messages.getExportedChatInvites#a2b5a3f6 returning error if any.
// Get info about the chat invites of a specific chat
//
// Possible errors:
//
//	400 ADMIN_ID_INVALID: The specified admin ID is invalid.
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.getExportedChatInvites for reference.
func ( *Client) ( context.Context,  *MessagesGetExportedChatInvitesRequest) (*MessagesExportedChatInvites, error) {
	var  MessagesExportedChatInvites

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