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

// MessagesCheckHistoryImportPeerRequest represents TL type `messages.checkHistoryImportPeer#5dc60f03`.
// Check whether chat history exported from another chat app can be imported into a
// specific Telegram chat, click here for more info »¹.
// If the check succeeds, and no RPC errors are returned, a messages
// CheckedHistoryImportPeer¹ constructor will be returned, with a confirmation text to
// be shown to the user, before actually initializing the import.
//
// Links:
//  1. https://core.telegram.org/api/import
//  2. https://core.telegram.org/type/messages.CheckedHistoryImportPeer
//
// See https://core.telegram.org/method/messages.checkHistoryImportPeer for reference.
type MessagesCheckHistoryImportPeerRequest struct {
	// The chat where we want to import history »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/import
	Peer InputPeerClass
}

// MessagesCheckHistoryImportPeerRequestTypeID is TL type id of MessagesCheckHistoryImportPeerRequest.
const MessagesCheckHistoryImportPeerRequestTypeID = 0x5dc60f03

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

func ( *MessagesCheckHistoryImportPeerRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesCheckHistoryImportPeerRequest from given interface.
func ( *MessagesCheckHistoryImportPeerRequest) ( interface {
	() ( InputPeerClass)
}) {
	.Peer = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesCheckHistoryImportPeerRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.checkHistoryImportPeer",
		ID:   MessagesCheckHistoryImportPeerRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesCheckHistoryImportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkHistoryImportPeer#5dc60f03 as nil")
	}
	.PutID(MessagesCheckHistoryImportPeerRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesCheckHistoryImportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkHistoryImportPeer#5dc60f03 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.checkHistoryImportPeer#5dc60f03: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.checkHistoryImportPeer#5dc60f03: field peer: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesCheckHistoryImportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.checkHistoryImportPeer#5dc60f03 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.checkHistoryImportPeer#5dc60f03: field peer: %w", )
		}
		.Peer = 
	}
	return nil
}

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

// MessagesCheckHistoryImportPeer invokes method messages.checkHistoryImportPeer#5dc60f03 returning error if any.
// Check whether chat history exported from another chat app can be imported into a
// specific Telegram chat, click here for more info »¹.
// If the check succeeds, and no RPC errors are returned, a messages
// CheckedHistoryImportPeer¹ constructor will be returned, with a confirmation text to
// be shown to the user, before actually initializing the import.
//
// Links:
//  1. https://core.telegram.org/api/import
//  2. https://core.telegram.org/type/messages.CheckedHistoryImportPeer
//
// Possible errors:
//
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 USER_NOT_MUTUAL_CONTACT: The provided user is not a mutual contact.
//
// See https://core.telegram.org/method/messages.checkHistoryImportPeer for reference.
func ( *Client) ( context.Context,  InputPeerClass) (*MessagesCheckedHistoryImportPeer, error) {
	var  MessagesCheckedHistoryImportPeer

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