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

// MessagesCheckHistoryImportRequest represents TL type `messages.checkHistoryImport#43fe19f3`.
// Obtains information about a chat export file, generated by a foreign chat app, click
// here for more info about imported chats »¹.
//
// Links:
//  1. https://core.telegram.org/api/import
//
// See https://core.telegram.org/method/messages.checkHistoryImport for reference.
type MessagesCheckHistoryImportRequest struct {
	// Beginning of the message file; up to 100 lines.
	ImportHead string
}

// MessagesCheckHistoryImportRequestTypeID is TL type id of MessagesCheckHistoryImportRequest.
const MessagesCheckHistoryImportRequestTypeID = 0x43fe19f3

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

func ( *MessagesCheckHistoryImportRequest) () bool {
	if  == nil {
		return true
	}
	if !(.ImportHead == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesCheckHistoryImportRequest from given interface.
func ( *MessagesCheckHistoryImportRequest) ( interface {
	() ( string)
}) {
	.ImportHead = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesCheckHistoryImportRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.checkHistoryImport",
		ID:   MessagesCheckHistoryImportRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ImportHead",
			SchemaName: "import_head",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesCheckHistoryImportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkHistoryImport#43fe19f3 as nil")
	}
	.PutID(MessagesCheckHistoryImportRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesCheckHistoryImportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkHistoryImport#43fe19f3 as nil")
	}
	.PutString(.ImportHead)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesCheckHistoryImportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.checkHistoryImport#43fe19f3 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.checkHistoryImport#43fe19f3: field import_head: %w", )
		}
		.ImportHead = 
	}
	return nil
}

// GetImportHead returns value of ImportHead field.
func ( *MessagesCheckHistoryImportRequest) () ( string) {
	if  == nil {
		return
	}
	return .ImportHead
}

// MessagesCheckHistoryImport invokes method messages.checkHistoryImport#43fe19f3 returning error if any.
// Obtains information about a chat export file, generated by a foreign chat app, click
// here for more info about imported chats »¹.
//
// Links:
//  1. https://core.telegram.org/api/import
//
// Possible errors:
//
//	400 IMPORT_FORMAT_UNRECOGNIZED: The specified chat export file was exported from an unsupported chat app.
//
// See https://core.telegram.org/method/messages.checkHistoryImport for reference.
func ( *Client) ( context.Context,  string) (*MessagesHistoryImportParsed, error) {
	var  MessagesHistoryImportParsed

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